lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 5a2bf3e 4/4: Restructure 'check_git_setup.sh'


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 5a2bf3e 4/4: Restructure 'check_git_setup.sh'
Date: Mon, 13 Nov 2017 14:11:28 -0500 (EST)

branch: master
commit 5a2bf3ea6d55a1924e09f13edf90146eeb9c2e82
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Restructure 'check_git_setup.sh'
    
    See:
      https://lists.nongnu.org/archive/html/lmi/2017-11/msg00022.html
    et seq.
---
 check_git_setup.sh | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/check_git_setup.sh b/check_git_setup.sh
index 4b9f7b6..7335fc3 100755
--- a/check_git_setup.sh
+++ b/check_git_setup.sh
@@ -41,21 +41,30 @@ printf "core.filemode is '%s'\n" $(git config --get-all 
core.filemode)
 # deliberately the "toplevel" directory.
 
 cd $(dirname $(readlink --canonicalize $0))
+
 case "$(readlink -f .git/hooks)" in
   ("$(pwd)/.git/hooks")
-    printf "must reconfigure git hooks directory\n"
-    mv .git/hooks .git/hooks-orig
-    ln --symbolic --force --no-dereference ../hooks .git
+    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
     ;;
+esac
+
+printf "  'readlink -f .git/hooks':\n"
+printf "    expected '%s'\n" "$(pwd)"/hooks
+printf "    observed '%s'\n" "$(readlink -f .git/hooks)"
+
+case "$(readlink -f .git/hooks)" in
   ("$(pwd)/hooks")
     printf "git hooks directory is properly symlinked\n"
+    exit 0
+    ;;
+  ("$(pwd)/.git/hooks")
+    printf "attempted hooks/ change failed\n"
+    exit 1
     ;;
   (*)
     printf "unanticipated error\n"
+    exit 2
     ;;
 esac
 
-printf "  'readlink -f .git/hooks':\n"
-printf "    expected '%s'\n" "$(pwd)"/hooks
-printf "    observed '%s'\n" "$(readlink -f .git/hooks)"
-



reply via email to

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