diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2017-12-05 23:40:41 -0500 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2020-01-15 19:54:23 +0000 |
| commit | f51a73253c4da005cfdf18a036e11185c04c8ce3 (patch) | |
| tree | 11f8d4f696b1975c133791910ebd60b052914668 /git-codereview/mail.go | |
| parent | f64da474f58aa878a967c0f87c39747f42fe6b63 (diff) | |
| download | go-x-review-f51a73253c4da005cfdf18a036e11185c04c8ce3.tar.xz | |
git-codereview: add mail -nokeycheck option
This adds a flag to set git push -o nokeycheck.
This is an alternative to CL 163158 (to always do it) and CL 81937
(which adds a broader flag without much in the way of guidance of how
to use it)
Change-Id: I42b1c047ac92aeaea98c0838738e265ffdca0108
Reviewed-on: https://go-review.googlesource.com/c/review/+/214918
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'git-codereview/mail.go')
| -rw-r--r-- | git-codereview/mail.go | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/git-codereview/mail.go b/git-codereview/mail.go index 55e2c28..fd663af 100644 --- a/git-codereview/mail.go +++ b/git-codereview/mail.go @@ -16,20 +16,21 @@ import ( func cmdMail(args []string) { var ( - diff = flags.Bool("diff", false, "show change commit diff and don't upload or mail") - force = flags.Bool("f", false, "mail even if there are staged changes") - topic = flags.String("topic", "", "set Gerrit topic") - trybot = flags.Bool("trybot", false, "run trybots on the uploaded CLs") - rList = new(stringList) // installed below - ccList = new(stringList) // installed below - tagList = new(stringList) // installed below + diff = flags.Bool("diff", false, "show change commit diff and don't upload or mail") + force = flags.Bool("f", false, "mail even if there are staged changes") + topic = flags.String("topic", "", "set Gerrit topic") + trybot = flags.Bool("trybot", false, "run trybots on the uploaded CLs") + rList = new(stringList) // installed below + ccList = new(stringList) // installed below + tagList = new(stringList) // installed below + noKeyCheck = flags.Bool("nokeycheck", false, "set 'git push -o nokeycheck', to prevent Gerrit from checking for private keys") ) flags.Var(rList, "r", "comma-separated list of reviewers") flags.Var(ccList, "cc", "comma-separated list of people to CC:") flags.Var(tagList, "hashtag", "comma-separated list of tags to set") flags.Usage = func() { - fmt.Fprintf(stderr(), "Usage: %s mail %s [-r reviewer,...] [-cc mail,...] [-topic topic] [-trybot] [-hashtag tag,...] [commit]\n", os.Args[0], globalFlags) + fmt.Fprintf(stderr(), "Usage: %s mail %s [-r reviewer,...] [-cc mail,...] [-nokeycheck] [-topic topic] [-trybot] [commit]\n", os.Args[0], globalFlags) } flags.Parse(args) if len(flags.Args()) > 1 { @@ -135,7 +136,12 @@ func cmdMail(args []string) { refSpec += start + "l=Run-TryBot" start = "," } - run("git", "push", "-q", "origin", refSpec) + args = []string{"push", "-q"} + if *noKeyCheck { + args = append(args, "-o", "nokeycheck") + } + args = append(args, "origin", refSpec) + run("git", args...) // Create local tag for mailed change. // If in the 'work' branch, this creates or updates work.mailed. |
