aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2020-06-11 09:57:58 +0200
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-17 13:11:54 -0300
commit9936257b58805dc32c263c6d680977cfe8897266 (patch)
treec61fa9b86371f71309b98d49c7b66401b320e78c
parent116defd6b4b32a9bf81039a64c63040491f03ce2 (diff)
downloadgcc-9936257b58805dc32c263c6d680977cfe8897266.zip
gcc-9936257b58805dc32c263c6d680977cfe8897266.tar.gz
gcc-9936257b58805dc32c263c6d680977cfe8897266.tar.bz2
contrib: Avoid redundant 'git diff' in prepare-commit-msg hook
contrib/ChangeLog: * prepare-commit-msg: Use 'tee' to save the diff to a file instead of running 'git diff' twice.
-rwxr-xr-xcontrib/prepare-commit-msg6
1 files changed, 4 insertions, 2 deletions
diff --git a/contrib/prepare-commit-msg b/contrib/prepare-commit-msg
index 24f0783..57bb917 100755
--- a/contrib/prepare-commit-msg
+++ b/contrib/prepare-commit-msg
@@ -59,7 +59,9 @@ fi
# Save diff to a file if requested.
if ! [ -z "$GCC_GIT_DIFF_FILE" ]; then
- git $cmd > "$GCC_GIT_DIFF_FILE";
+ tee="tee $GCC_GIT_DIFF_FILE"
+else
+ tee="cat"
fi
-git $cmd | git gcc-mklog -c "$COMMIT_MSG_FILE"
+git $cmd | $tee | git gcc-mklog -c "$COMMIT_MSG_FILE"