Skip to content

Commit ecc6f85

Browse files
committed
Add a new 'dump' command to view the cache contents.
1 parent 0c79f1f commit ecc6f85

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

git-subtrac.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ func fatalf(fmt string, args ...interface{}) {
1414

1515
var usage_str = `
1616
Commands:
17-
cid <ref> Print the id of a tracking commit based on the given ref
18-
update Update all local branches with a matching *.trac branch
17+
cid <ref> Print the id of a tracking commit based on the given ref
18+
dump <refs...> Print the cache after loading the given branch ref(s)
19+
update Update all local branches with a matching *.trac branch
1920
`
2021

2122
func usage() {
@@ -79,6 +80,17 @@ func main() {
7980
fatalf("%v\n", err)
8081
}
8182
fmt.Printf("%v\n", trac.Hash)
83+
case "dump":
84+
if len(args) < 2 {
85+
usagef("command 'dump' takes at least 1 argument")
86+
}
87+
for _, refname := range args[1:] {
88+
_, err := c.TracByRef(refname)
89+
if err != nil {
90+
fatalf("%v\n", err)
91+
}
92+
}
93+
fmt.Printf("%v\n", c)
8294
default:
8395
usagef("unknown command %v", args[0])
8496
}

0 commit comments

Comments
 (0)