summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-08-22 19:23:55 -0700
committerShawn O. Pearce <sop@google.com>2009-08-22 19:23:55 -0700
commit15f6579eb3a2f3cb0e432ed39ac39d8678786161 (patch)
tree156a3d9d0e47df02293ac60c6d93bb8017634a25
parentd4cd69bdef28c5a9287c85c48a18ce621eba689d (diff)
downloadgit-repo-15f6579eb3a2f3cb0e432ed39ac39d8678786161.tar.gz
commit-msg: Update the commit message hook
This version fixes a bug where Change-Id lines become the subject line, if the subject used a pattern like the subject of this message does. Change-Id: I7f7e0363091d03eb05dead2992fc19763214de65 Signed-off-by: Shawn O. Pearce <sop@google.com>
-rwxr-xr-xhooks/commit-msg26
1 files changed, 24 insertions, 2 deletions
diff --git a/hooks/commit-msg b/hooks/commit-msg
index ecd6a20b..5b1fe3ae 100755
--- a/hooks/commit-msg
+++ b/hooks/commit-msg
@@ -1,4 +1,22 @@
1#!/bin/sh 1#!/bin/sh
2# From Gerrit Code Review v2.0.18-100-g98fc90a
3#
4# Part of Gerrit Code Review (http://code.google.com/p/gerrit/)
5#
6# Copyright (C) 2009 The Android Open Source Project
7#
8# Licensed under the Apache License, Version 2.0 (the "License");
9# you may not use this file except in compliance with the License.
10# You may obtain a copy of the License at
11#
12# http://www.apache.org/licenses/LICENSE-2.0
13#
14# Unless required by applicable law or agreed to in writing, software
15# distributed under the License is distributed on an "AS IS" BASIS,
16# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17# See the License for the specific language governing permissions and
18# limitations under the License.
19#
2 20
3MSG="$1" 21MSG="$1"
4 22
@@ -13,8 +31,12 @@ add_ChangeId() {
13 id=$(_gen_ChangeId) 31 id=$(_gen_ChangeId)
14 out="$MSG.new" 32 out="$MSG.new"
15 ftt="$MSG.footers" 33 ftt="$MSG.footers"
16 sed -e '/^[A-Za-z][A-Za-z0-9-]*: /,$d' <"$MSG" >"$out" 34 sed -e '2,${
17 sed -ne '/^[A-Za-z][A-Za-z0-9-]*: /,$p' <"$MSG" >"$ftt" 35 /^[A-Za-z][A-Za-z0-9-]*: /,$d
36 }' <"$MSG" >"$out"
37 sed -ne '2,${
38 /^[A-Za-z][A-Za-z0-9-]*: /,$p
39 }' <"$MSG" >"$ftt"
18 if ! [ -s "$ftt" ] 40 if ! [ -s "$ftt" ]
19 then 41 then
20 echo >>"$out" 42 echo >>"$out"