Automatically sign off commits when rewriting for gerrit
Also, while we are here, ignore backup branches. This makes it so we
can use subtree with our new sign off procedure.
Change-Id: Ieed40dc8da637aef005d846264aaf661fa925c0a
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/third_party/rewrite_subtree.sh b/third_party/rewrite_subtree.sh
index a3e5372..e565d2b 100755
--- a/third_party/rewrite_subtree.sh
+++ b/third_party/rewrite_subtree.sh
@@ -13,11 +13,13 @@
set -e
set -o pipefail
+export SIGNOFF="Signed-off-by: $(git config --get user.name) <$(git config --get user.email)>"
+
GIT_DIR=$(readlink -f "$(git rev-parse --git-dir)")
TMP_MSG="${GIT_DIR}/COMMIT_MSG_REWRITE"
-git filter-branch --msg-filter \
- "cat > ${TMP_MSG} && \"${GIT_DIR}/hooks/commit-msg\" ${TMP_MSG} && \
+git filter-branch -f --msg-filter \
+ "cat | git interpret-trailers --trailer \"$SIGNOFF\" > ${TMP_MSG} && \"${GIT_DIR}/hooks/commit-msg\" ${TMP_MSG} && \
cat \"${TMP_MSG}\"" HEAD...HEAD~1
rm -rf "${TMP_MSG}"