diff options
| author | Jeff Carr <[email protected]> | 2025-03-23 04:41:21 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-03-23 04:41:21 -0500 |
| commit | 8da6cd3ad245f1b1601446533b4a11b98ddf4b77 (patch) | |
| tree | b46a9a94fdff91a75f5219b83f9f78d2f3b6f756 /main.go | |
| parent | dbf1b088692b741d4f35e5f7d7ad99bbd327f70d (diff) | |
tried to get a git ref log but failedv0.0.9
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 30 |
1 files changed, 29 insertions, 1 deletions
@@ -21,9 +21,37 @@ func main() { if repo == nil { os.Exit(-1) } - walkBranches(repo) + b := walkBranches(repo) + + // o, err := b.Reference.Peel(b.Reference.Type()) + o, err := b.Reference.Peel(git.ObjectTree) + if err != nil { + log.Info("ref peel() failed", err) + return + } + t, errt := o.AsTree() + if errt != nil { + log.Info("object AsTree() failed", errt) + return + } + walkTree(t) +} + +// lists the files in the git repo +// Makefile, .gitignore, README.md, etc +func walkTree(tree *git.Tree) { + var callCount int + err := tree.Walk(func(name string, entry *git.TreeEntry) error { + callCount++ + log.Info("walkTree()", callCount, entry.Name, entry.Id, entry.Type) + + return nil + }) + log.Info("walkTree() count", callCount, err) } +// lists the branches +// "master", "devel", "jcarr" func walkBranches(repo *git.Repository) *git.Branch { i, err := repo.NewBranchIterator(git.BranchLocal) if err != nil { |
