Rename git-whitespace-hook to dune-git-whitespace-hook.
authorAnsgar Burchardt <ansgar@debian.org>
Thu, 21 Jun 2018 07:17:17 +0000 (08:17 +0100)
committerAnsgar Burchardt <ansgar@debian.org>
Thu, 21 Jun 2018 07:17:17 +0000 (08:17 +0100)
The name git-whitespace-hook is a bit too generic for a DUNE-specific
tool.

Gbp-Pq: Name rename-git-whitespace-hook.patch

bin/dunecontrol

index 7de0ce2ed4ae5844cf675dab7d3fe09cd1414c87..da62ac3f3692c87708f1a922a08cfb108f903a1d 100755 (executable)
@@ -520,17 +520,28 @@ run_default_vcsetup() {
         fi
       else
         # standard handling of Git whitespace hook
+        for f in dune-git-whitespace-hook git-whitespace-hook; do
+          f="${PREFIX_DIR}/bin/${f}"
+          if [ -e "${f}" ]; then
+            git_whitespace_hook="${f}"
+            break
+          fi
+        done
+        if [ -z "${git_whitespace_hook:-}" ]; then
+          echo "Did not find git-whitespace-hook." >&2
+          exit 1
+        fi
         if [ ! -e "$GITHOOKPATH" ]; then
           # there is no hook yet, we can safely install ours
           echo "--> Installing Git pre-commit hook to enforce whitespace policy"
-          cp -p "$PREFIX_DIR/bin/git-whitespace-hook" "$GITHOOKPATH"
+          cp -p "${git_whitespace_hook}" "$GITHOOKPATH"
         else
           # there is already a hook, check whether it is our whitespace hook
           local HOOKTAG="$(eval head -n 2 \"$GITHOOKPATH\" | tail -n 1)"
           if [ "x$HOOKTAG" = "x# dune-git-whitespace-hook" ]; then
-            if [ "$PREFIX_DIR/bin/git-whitespace-hook" -nt "$GITHOOKPATH" ]; then
+            if [ "${git_whitespace_hook}" -nt "$GITHOOKPATH" ]; then
               echo "--> Updating Git pre-commit hook with newer version"
-              cp -p "$PREFIX_DIR/bin/git-whitespace-hook" "$GITHOOKPATH"
+              cp -p "${git_whitespace_hook}" "$GITHOOKPATH"
             fi
           else
             echo "WARNING: Existing pre-commit hook found!"