diff options
| author | Josh Bleecher Snyder <josharian@gmail.com> | 2016-06-10 07:12:36 -0700 |
|---|---|---|
| committer | Josh Bleecher Snyder <josharian@gmail.com> | 2016-06-14 01:16:19 +0000 |
| commit | 9f7b28f5a3254d248b82a181bef7195f722ff762 (patch) | |
| tree | 1097768423f7673660a49de8ef78346007d32dc2 /git-codereview/review.go | |
| parent | 4a86a651c993b954a45140a6ae77b4510674faaf (diff) | |
| download | go-x-review-9f7b28f5a3254d248b82a181bef7195f722ff762.tar.xz | |
git-codereview: pass args to installHook
This enables passing -v to
'git codereview hooks'
to see what commands are being run.
It also means that automatic installation of
hooks should respect -n.
Change-Id: I812685b43e9ea678641f64b2182b957342a4e43c
Reviewed-on: https://go-review.googlesource.com/24002
Reviewed-by: Andrew Gerrand <adg@golang.org>
Diffstat (limited to 'git-codereview/review.go')
| -rw-r--r-- | git-codereview/review.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/git-codereview/review.go b/git-codereview/review.go index 779b77c..c83a95b 100644 --- a/git-codereview/review.go +++ b/git-codereview/review.go @@ -127,7 +127,17 @@ func main() { // Install hooks automatically, but only if this is a Gerrit repo. if haveGerrit() { - installHook() + // Don't pass installHook args directly, + // since args might contain args meant for other commands. + // Filter down to just global flags. + var hookArgs []string + for _, arg := range args { + switch arg { + case "-n", "-v": + hookArgs = append(hookArgs, arg) + } + } + installHook(hookArgs) } switch command { @@ -140,7 +150,7 @@ func main() { case "hook-invoke": cmdHookInvoke(args) case "hooks": - installHook() // in case above was bypassed + installHook(args) // in case above was bypassed case "mail", "m": cmdMail(args) case "pending": |
