Place change-id always at the end of the commit msg
See gerrit issue:
https: //gerrit-review.googlesource.com/c/gerrit/+/316124
Change-Id: Icea843a6a22a3afe5f6413f019e0e8847a0b84af
diff --git a/bin/import_github_pull_requests b/bin/import_github_pull_requests
index 5e00c14..566fbbd 100755
--- a/bin/import_github_pull_requests
+++ b/bin/import_github_pull_requests
@@ -54,7 +54,11 @@
git fetch github
git fetch origin
OLDHEAD=$(git log --pretty=format:%H -1)
-
+COMMIT_MSG_HOOK_BAK_EXT=.bak.${RANDOM}
+COMMIT_MSG_HOOK_BAK=.git/hooks/commit-msg${COMMIT_MSG_HOOK_BAK_EXT}
+if grep --q -- '^[ ]*--trailer' .git/hooks/commit-msg; then
+ sed -i${COMMIT_MSG_HOOK_BAK} -e 's/^\( *\)--trailer/\1--no-divider --trailer/' .git/hooks/commit-msg
+fi
while IFS=',' read -r success nr sha message; do
if [ "$success" == "$GET_CI_STATUS_SUCCESS" ]; then
if git cherry-pick "$sha" > /dev/null 2> /dev/null; then
@@ -81,6 +85,10 @@
sed 's/["]//g' | sed 's/\\n\\n.*//g'
fi
)
+if [ -e ${COMMIT_MSG_HOOK_BAK} ]; then
+ mv ${COMMIT_MSG_HOOK_BAK} .git/hooks/commit-msg
+fi
+
NEWHEAD=$(git log --pretty=format:%H -1)
if [ "$NEWHEAD" == "$OLDHEAD" ]; then
echo