[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master f92ba83 3/7: Allow backup of old .git/hooks t
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master f92ba83 3/7: Allow backup of old .git/hooks to fail |
Date: |
Thu, 16 Nov 2017 11:09:55 -0500 (EST) |
branch: master
commit f92ba83462e10af64578b3a37af83b031580f0a5
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Allow backup of old .git/hooks to fail
Presumably this script will not be run by anyone who personally
customizes git hooks. Existing hooks are moved aside anyway, as a
courtesy, even though most commonly this only preserves git's
default 'hooks/*.sample' scripts. Previously, failure of the mv
command caused the script to terminate, so that it didn't fulfill
its purpose if the default hooks directory had been removed. Now
it reports whether the mv command succeeded or failed, but keeps
going in either case.
---
check_git_setup.sh | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/check_git_setup.sh b/check_git_setup.sh
index 2914bde..88663f7 100755
--- a/check_git_setup.sh
+++ b/check_git_setup.sh
@@ -42,11 +42,16 @@ esac
printf "core.filemode is '%s'\n" $(git config --get-all core.filemode)
# Make sure the hooks in the repository's hooks/ directory are used.
+#
+# The mv command is a nicety; it's okay if it fails because no
+# .git/hooks subdirectory exists.
case "$(readlink -f .git/hooks)" in
("$PWD/.git/hooks")
- printf "moving old hooks directory to hooks-orig/ and creating symlink\n"
- mv .git/hooks .git/hooks-orig && ln --symbolic --force --no-dereference
../hooks .git
+ mv .git/hooks .git/hooks-orig && printf "moved" || printf "didn't move"
+ printf " old hooks/ directory to hooks-orig/\n"
+ printf "creating symlink\n"
+ ln --symbolic --force --no-dereference ../hooks .git
;;
esac
- [lmi-commits] [lmi] master updated (2a7f972 -> c8de75e), Greg Chicares, 2017/11/16
- [lmi-commits] [lmi] master 0b4d84b 2/7: Prefer $PWD to $(pwd), Greg Chicares, 2017/11/16
- [lmi-commits] [lmi] master bf52d55 6/7: Require a valid pre-commit hook to exist, Greg Chicares, 2017/11/16
- [lmi-commits] [lmi] master 68cc423 4/7: Regularize readlink options, Greg Chicares, 2017/11/16
- [lmi-commits] [lmi] master f92ba83 3/7: Allow backup of old .git/hooks to fail,
Greg Chicares <=
- [lmi-commits] [lmi] master 1e1716f 5/7: Assert rather than assume, Greg Chicares, 2017/11/16
- [lmi-commits] [lmi] master 030f1c5 1/7: Fix incorrect command order, Greg Chicares, 2017/11/16
- [lmi-commits] [lmi] master c8de75e 7/7: Show symlink in a few of its many guises, Greg Chicares, 2017/11/16