diff options
| author | Russ Cox <rsc@golang.org> | 2017-11-09 22:27:37 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2017-11-16 01:36:40 +0000 |
| commit | 0d52c016f0bb80623e0ce00bf4e92981bacf862e (patch) | |
| tree | d65021e2f934074a9c1fc8a49e4bfaa20d781c27 /git-codereview/mail.go | |
| parent | 69da225aa6e9f439011c7458bbbddd52b133aea9 (diff) | |
| download | go-x-review-0d52c016f0bb80623e0ce00bf4e92981bacf862e.tar.xz | |
git-codereview: add support for DΟ NΟT MAIL
Also create a local DΟ NΟT SUBMIT check,
although the Gerrit server is also taking care of that.
While we're here, make fixup! and squash! commits
non-mailable as well.
(In the all caps text above the big Os are really Omicrons.
Otherwise the CL would not be mailable or submittable.)
Change-Id: Id1a9806b0d395d1a0bfc50ed7d7d22c64a48a2f1
Reviewed-on: https://go-review.googlesource.com/76877
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'git-codereview/mail.go')
| -rw-r--r-- | git-codereview/mail.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/git-codereview/mail.go b/git-codereview/mail.go index 040ef19..a63790f 100644 --- a/git-codereview/mail.go +++ b/git-codereview/mail.go @@ -51,6 +51,29 @@ func cmdMail(args []string) { dief("cannot mail: commit %s is empty", c.ShortHash) } + foundCommit := false + for _, c1 := range b.Pending() { + if c1 == c { + foundCommit = true + } + if !foundCommit { + continue + } + if strings.Contains(strings.ToLower(c1.Message), "do not mail") { + dief("%s: CL says DO NOT MAIL", c1.ShortHash) + } + if strings.HasPrefix(c1.Message, "fixup!") { + dief("%s: CL is a fixup! commit", c1.ShortHash) + } + if strings.HasPrefix(c1.Message, "squash!") { + dief("%s: CL is a squash! commit", c1.ShortHash) + } + } + if !foundCommit { + // b.CommitByRev and b.DefaultCommit both return a commit on b. + dief("internal error: did not find chosen commit on current branch") + } + if !*force && HasStagedChanges() { dief("there are staged changes; aborting.\n"+ "Use '%s change' to include them or '%s mail -f' to force it.", os.Args[0], os.Args[0]) |
