diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2020-06-11 09:57:58 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2020-06-11 09:57:58 +0200 |
commit | 9aadfdd650bc32150c9800b73fb3e5ac83fc5a72 (patch) | |
tree | f58e3d1c1a5e7cba64820da64f94eb6c491eb5ec /contrib | |
parent | 656e363bccc1926b223eb78962338d638ba72d32 (diff) | |
download | gcc-9aadfdd650bc32150c9800b73fb3e5ac83fc5a72.tar.gz |
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.
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/prepare-commit-msg | 6 |
1 files changed, 4 insertions, 2 deletions
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" |