aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gerrand <adg@golang.org>2016-07-08 13:39:53 +1000
committerAndrew Gerrand <adg@golang.org>2016-07-11 17:32:58 +0000
commitc272006fd6c67460073f6630cb366d1e62f66721 (patch)
tree96df0ecf6ac4b4b062cc62309d61d3006a14a2d4
parent81c5301fbb3669b2029d7eea3656867687db615a (diff)
downloadgo-x-review-c272006fd6c67460073f6630cb366d1e62f66721.tar.xz
git-codereview: add [branchname] when on release branch
This behavior was changed by 2865802. Change-Id: Ib5a254240d4e8a8254ce52929ed1ec2165d545e2 Reviewed-on: https://go-review.googlesource.com/24756 Reviewed-by: Chris Broadfoot <cbro@golang.org>
-rw-r--r--git-codereview/hook.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/git-codereview/hook.go b/git-codereview/hook.go
index 04fa87c..63e8fd7 100644
--- a/git-codereview/hook.go
+++ b/git-codereview/hook.go
@@ -188,11 +188,12 @@ func hookCommitMsg(args []string) {
data = append(data[:n], fmt.Sprintf("\n\nChange-Id: I%x\n", id[:])...)
}
- // Add branch prefix to commit message if not present and not on master
- // and not a special Git fixup! or squash! commit message.
+ // Add branch prefix to commit message if not present and on a
+ // dev or release branch and not a special Git fixup! or
+ // squash! commit message.
b := CurrentBranch()
branch := strings.TrimPrefix(b.OriginBranch(), "origin/")
- if strings.HasPrefix(branch, "dev.") {
+ if strings.HasPrefix(branch, "dev.") || strings.HasPrefix(branch, "release-branch.") {
prefix := "[" + branch + "] "
if !bytes.HasPrefix(data, []byte(prefix)) && !isFixup(data) {
data = []byte(prefix + string(data))