aboutsummaryrefslogtreecommitdiff
path: root/git-codereview/hook_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'git-codereview/hook_test.go')
-rw-r--r--git-codereview/hook_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/git-codereview/hook_test.go b/git-codereview/hook_test.go
index 8cb04f9..d1cc0c6 100644
--- a/git-codereview/hook_test.go
+++ b/git-codereview/hook_test.go
@@ -42,6 +42,16 @@ func TestHookCommitMsgGerrit(t *testing.T) {
if got := testStderr.String(); got != multiple {
t.Fatalf("unexpected output:\ngot: %q\nwant: %q", got, multiple)
}
+
+ // Check that hook doesn't add two line feeds before Change-Id
+ // if the exsting message ends with a metadata line.
+ write(t, gt.client+"/msg.txt", "Test message.\n\nBug: 1234\n")
+ testMain(t, "hook-invoke", "commit-msg", gt.client+"/msg.txt")
+ data = read(t, gt.client+"/msg.txt")
+ if !bytes.Contains(data, []byte("Bug: 1234\nChange-Id: ")) {
+ t.Fatalf("after hook-invoke commit-msg, missing Change-Id: directly after Bug line\n%s", data)
+ }
+
}
func TestHookCommitMsg(t *testing.T) {