From: Jonathan Wakely Date: Thu, 11 Jun 2020 07:57:58 +0000 (+0200) Subject: contrib: Avoid redundant 'git diff' in prepare-commit-msg hook X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9aadfdd650bc32150c9800b73fb3e5ac83fc5a72;p=gcc.git 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. --- diff --git a/contrib/prepare-commit-msg b/contrib/prepare-commit-msg index 24f0783aae2..57bb91747f6 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"