Skip to content

Commit b1f453b

Browse files
committed
fix(github): fix infinite recursion bug in git repo walker
Signed-off-by: ShigrafS <shigrafsalik@proton.me>
1 parent bab1118 commit b1f453b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

generators/github/git_repo.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,22 @@ func (gr GitRepo) GetContent() (models.Package, error) {
5656
Owner(owner).
5757
Repo(repo).
5858
Branch(branch).
59-
Root(root).
6059
MaxDepth(gr.MaxDepth).
6160
RegisterFileInterceptor(fileInterceptor(br)).
6261
RegisterDirInterceptor(dirInterceptor(br))
63-
64-
// Handle recursion
62+
// Handle recursion and depth
63+
effectiveRoot := root
6564
if gr.Recursive {
66-
if !strings.HasSuffix(root, "/**") {
67-
gw = gw.Root(root + "/**")
65+
if !strings.HasSuffix(effectiveRoot, "/**") {
66+
effectiveRoot += "/**"
6867
}
6968
} else {
7069
// If not recursive, ensure root does not end with /** which walker uses to toggle recursion
71-
if strings.HasSuffix(root, "/**") {
72-
gw = gw.Root(strings.TrimSuffix(root, "/**"))
70+
if strings.HasSuffix(effectiveRoot, "/**") {
71+
effectiveRoot = strings.TrimSuffix(effectiveRoot, "/**")
7372
}
7473
}
74+
gw = gw.Root(effectiveRoot)
7575

7676
if version != "" {
7777
gw = gw.ReferenceName(fmt.Sprintf("refs/tags/%s", version))

0 commit comments

Comments
 (0)