public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/guojiufu/heads/personal-branch)] contrib: Avoid redundant 'git diff' in prepare-commit-msg hook
@ 2020-06-13 2:54 Jiu Fu Guo
0 siblings, 0 replies; only message in thread
From: Jiu Fu Guo @ 2020-06-13 2:54 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:9aadfdd650bc32150c9800b73fb3e5ac83fc5a72
commit 9aadfdd650bc32150c9800b73fb3e5ac83fc5a72
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Jun 11 09:57:58 2020 +0200
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:
---
contrib/prepare-commit-msg | 6 ++++--
1 file 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"
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-06-13 2:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-13 2:54 [gcc(refs/users/guojiufu/heads/personal-branch)] contrib: Avoid redundant 'git diff' in prepare-commit-msg hook Jiu Fu Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).