public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/autopar_devel] contrib: Make prepare-commit-msg hook safe for older branches
@ 2020-08-22 21:51 Giuliano Belinassi
0 siblings, 0 replies; only message in thread
From: Giuliano Belinassi @ 2020-08-22 21:51 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:273450e60b27b1fcff42ec63c5818d252ad80355
commit 273450e60b27b1fcff42ec63c5818d252ad80355
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Jun 2 11:18:21 2020 +0100
contrib: Make prepare-commit-msg hook safe for older branches
If a user installs this script as .git/hooks/prepare-commit-msg and then
works on an old branch which doesn't have the mklog.py script, trying to
commit will fail with an error like:
environment: /.../gcc/contrib/mklog.py: No such file or directory
This makes it exit cleanly so it's possible to commit.
contrib/ChangeLog:
* prepare-commit-msg: Do nothing if the mklog.py script isn't
present.
Diff:
---
contrib/prepare-commit-msg | 3 +++
1 file changed, 3 insertions(+)
diff --git a/contrib/prepare-commit-msg b/contrib/prepare-commit-msg
index fd59bfbcf88..24f0783aae2 100755
--- a/contrib/prepare-commit-msg
+++ b/contrib/prepare-commit-msg
@@ -23,6 +23,9 @@ COMMIT_MSG_FILE=$1
COMMIT_SOURCE=$2
SHA1=$3
+# We might be on a branch before the file was added.
+if ! [ -x contrib/mklog.py ]; then exit 0; fi
+
# Can't do anything if $COMMIT_MSG_FILE isn't a file.
if ! [ -f "$COMMIT_MSG_FILE" ]; then exit 0; fi
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-08-22 21:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-22 21:51 [gcc/devel/autopar_devel] contrib: Make prepare-commit-msg hook safe for older branches Giuliano Belinassi
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).