lmi-commits
[Top][All Lists]
Advanced

[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
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]