Skip to content

Commit 03d6a33

Browse files
treussartMatthieu Treussart
and
Matthieu Treussart
authored
Changed: New arg for specify git path (#27)
Co-authored-by: Matthieu Treussart <[email protected]>
1 parent 45e54c7 commit 03d6a33

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

config.go

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ type config struct {
1313
compare []string
1414
benchCmd string
1515
benchArgs []string
16+
gitPath string
1617
}
1718

1819
func newConfig(c *cli.Context) config {
@@ -23,5 +24,6 @@ func newConfig(c *cli.Context) config {
2324
compare: strings.Split(c.String("compare"), ","),
2425
benchCmd: c.String("bench-cmd"),
2526
benchArgs: strings.Fields(c.String("bench-args")),
27+
gitPath: c.String("git-path"),
2628
}
2729
}

main.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ func main() {
6666
Usage: "Specify arguments passed to -cmd",
6767
Value: "test -run '^$' -bench . -benchmem ./...",
6868
},
69+
&cli.StringFlag{
70+
Name: "git-path",
71+
Usage: "Specify the path of the git repo",
72+
Value: ".",
73+
},
6974
},
7075
}
7176

@@ -76,7 +81,7 @@ func main() {
7681
}
7782

7883
func run(c config) error {
79-
r, err := git.PlainOpen(".")
84+
r, err := git.PlainOpen(c.gitPath)
8085
if err != nil {
8186
return xerrors.Errorf("unable to open the git repository: %w", err)
8287
}

0 commit comments

Comments
 (0)