Created
October 26, 2023 23:34
-
-
Save andrewpollock/0c51ca92fdb77f1b0671a69c8187d949 to your computer and use it in GitHub Desktop.
Reproduction case for https://github.com/go-git/go-git/issues/373
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/go-git/go-git/v5" | |
) | |
var submodules []*git.Repository | |
func main() { | |
fmt.Println("Hello, world.") | |
repo, err := git.PlainOpen("/tmp/pd-server") | |
if err != nil { | |
fmt.Printf("%#v\n", err) | |
} | |
worktree, err := repo.Worktree() | |
if err != nil { | |
fmt.Printf("%#v\n", err) | |
} | |
ss, err := worktree.Submodules() | |
if err != nil { | |
fmt.Printf("%#v\n", err) | |
} | |
for _, s := range ss { | |
repo, err := s.Repository() | |
if err != nil { | |
fmt.Printf("%#v\n", err) | |
continue | |
} | |
submodules = append(submodules, repo) | |
} | |
fmt.Printf("%#v\n", submodules) | |
} |
Author
andrewpollock
commented
Oct 26, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment