mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-28 07:23:43 +02:00
fixup! Convert flashrom to git
- update the commit-msg hook to the latest one provided by Gerrit. However, disable the (new) code that would avoid adding Change-IDs to fixup/squash commits as needed on the staging branch Change-Id: I2f2d7ae58dcd7d3e55959e18fe664df10bc3cc41 Signed-off-by: Stefan Tauner <stefan.tauner@gmx.at> Reviewed-on: https://review.coreboot.org/21832 Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
68b5f00930
commit
3a937b7732
@ -1,6 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Part of Gerrit Code Review (http://code.google.com/p/gerrit/)
|
# Change-ID amending from Gerrit Code Review 2.14.2
|
||||||
|
#
|
||||||
|
# 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
|
||||||
#
|
#
|
||||||
@ -17,14 +19,16 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
CHANGE_ID_AFTER="Bug|Issue"
|
unset GREP_OPTIONS
|
||||||
|
|
||||||
|
CHANGE_ID_AFTER="Bug|Depends-On|Issue|Test|Feature|Fixes|Fixed|Staging-ID"
|
||||||
MSG="$1"
|
MSG="$1"
|
||||||
|
|
||||||
# Check for, and add if missing, a unique Change-Id
|
# Check for, and add if missing, a unique Change-Id
|
||||||
#
|
#
|
||||||
add_ChangeId() {
|
add_ChangeId() {
|
||||||
clean_message=`sed -e '
|
clean_message=`sed -e '
|
||||||
/^diff --git a\/.*/{
|
/^diff --git .*/{
|
||||||
s///
|
s///
|
||||||
q
|
q
|
||||||
}
|
}
|
||||||
@ -36,8 +40,19 @@ add_ChangeId() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# *Do* add Change-Id to temp commits (original code bails out here)
|
||||||
|
# if echo "$clean_message" | head -1 | grep -q '^\(fixup\|squash\)!'
|
||||||
|
# then
|
||||||
|
# return
|
||||||
|
# fi
|
||||||
|
|
||||||
|
if test "false" = "`git config --bool --get gerrit.createChangeId`"
|
||||||
|
then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
# Does Change-Id: already exist? if so, exit (no change).
|
# Does Change-Id: already exist? if so, exit (no change).
|
||||||
if grep -i '^Change-Id: I[0-9a-f]\{40\}$' "$MSG" >/dev/null
|
if grep -i '^Change-Id:' "$MSG" >/dev/null
|
||||||
then
|
then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -50,6 +65,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
|
||||||
@ -68,13 +87,13 @@ 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.
|
||||||
# If more than one line before the diff was empty, strip all but one.
|
# If more than one line before the diff was empty, strip all but one.
|
||||||
/^diff --git a/ {
|
/^diff --git / {
|
||||||
blankLines = 0
|
blankLines = 0
|
||||||
while (getline) { }
|
while (getline) { }
|
||||||
next
|
next
|
||||||
@ -151,7 +170,7 @@ add_ChangeId() {
|
|||||||
if (unprinted) {
|
if (unprinted) {
|
||||||
print "Change-Id: I'"$id"'"
|
print "Change-Id: I'"$id"'"
|
||||||
}
|
}
|
||||||
}' "$MSG" > $T && mv $T "$MSG" || rm -f $T
|
}' "$MSG" > "$T" && mv "$T" "$MSG" || rm -f "$T"
|
||||||
}
|
}
|
||||||
_gen_ChangeIdInput() {
|
_gen_ChangeIdInput() {
|
||||||
echo "tree `git write-tree`"
|
echo "tree `git write-tree`"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user