mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Update commit-msg hook to version from Gerrit 2.12.1
Change-Id: I31b74aba998f8e83f370a759218777f2557a8872
This commit is contained in:
parent
4aa4b211c6
commit
9322964d14
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
# From Gerrit Code Review 2.12.1
|
||||||
#
|
#
|
||||||
# Part of Gerrit Code Review (http://code.google.com/p/gerrit/)
|
# Part of Gerrit Code Review (https://www.gerritcodereview.com/)
|
||||||
#
|
#
|
||||||
# Copyright (C) 2009 The Android Open Source Project
|
# Copyright (C) 2009 The Android Open Source Project
|
||||||
#
|
#
|
||||||
@ -19,7 +20,7 @@
|
|||||||
|
|
||||||
unset GREP_OPTIONS
|
unset GREP_OPTIONS
|
||||||
|
|
||||||
CHANGE_ID_AFTER="Bug|Issue"
|
CHANGE_ID_AFTER="Bug|Issue|Test"
|
||||||
MSG="$1"
|
MSG="$1"
|
||||||
|
|
||||||
# Check for, and add if missing, a unique Change-Id
|
# Check for, and add if missing, a unique Change-Id
|
||||||
@ -38,6 +39,12 @@ add_ChangeId() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Do not add Change-Id to temp commits
|
||||||
|
if echo "$clean_message" | head -1 | grep -q '^\(fixup\|squash\)!'
|
||||||
|
then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
if test "false" = "`git config --bool --get gerrit.createChangeId`"
|
if test "false" = "`git config --bool --get gerrit.createChangeId`"
|
||||||
then
|
then
|
||||||
return
|
return
|
||||||
@ -57,6 +64,10 @@ add_ChangeId() {
|
|||||||
AWK=/usr/xpg4/bin/awk
|
AWK=/usr/xpg4/bin/awk
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Get core.commentChar from git config or use default symbol
|
||||||
|
commentChar=`git config --get core.commentChar`
|
||||||
|
commentChar=${commentChar:-#}
|
||||||
|
|
||||||
# How this works:
|
# How this works:
|
||||||
# - parse the commit message as (textLine+ blankLine*)*
|
# - parse the commit message as (textLine+ blankLine*)*
|
||||||
# - assume textLine+ to be a footer until proven otherwise
|
# - assume textLine+ to be a footer until proven otherwise
|
||||||
@ -75,8 +86,8 @@ add_ChangeId() {
|
|||||||
blankLines = 0
|
blankLines = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# Skip lines starting with "#" without any spaces before it.
|
# Skip lines starting with commentChar without any spaces before it.
|
||||||
/^#/ { next }
|
/^'"$commentChar"'/ { next }
|
||||||
|
|
||||||
# Skip the line starting with the diff command and everything after it,
|
# Skip the line starting with the diff command and everything after it,
|
||||||
# up to the end of the file, assuming it is only patch data.
|
# up to the end of the file, assuming it is only patch data.
|
||||||
|
Loading…
Reference in New Issue
Block a user