Fix commit-msg hook to handle first lines like "foo: fix the bar"
Because we allowed the file to be split on the very first line, we became confused on subject lines like "foo: fix the bar", thinking that the subject line itself was the start of the footers. Instead we start our search on the 2nd line, making it much less likely we will run into problems splitting the message. Change-Id: I99d9852bb2260ff018762c65a6585a5dd339b75d Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -13,8 +13,12 @@ add_ChangeId() {
|
||||
id=$(_gen_ChangeId)
|
||||
out="$MSG.new"
|
||||
ftt="$MSG.footers"
|
||||
sed -e '/^[A-Za-z][A-Za-z0-9-]*: /,$d' <"$MSG" >"$out"
|
||||
sed -ne '/^[A-Za-z][A-Za-z0-9-]*: /,$p' <"$MSG" >"$ftt"
|
||||
sed -e '2,${
|
||||
/^[A-Za-z][A-Za-z0-9-]*: /,$d
|
||||
}' <"$MSG" >"$out"
|
||||
sed -ne '2,${
|
||||
/^[A-Za-z][A-Za-z0-9-]*: /,$p
|
||||
}' <"$MSG" >"$ftt"
|
||||
if ! [ -s "$ftt" ]
|
||||
then
|
||||
echo >>"$out"
|
||||
|
||||
Reference in New Issue
Block a user