]> gitweb.fluxo.info Git - git-hooks.git/commitdiff
Handle repository paths that contains spaces
authorBenjamin C Meyer <ben@meyerhome.net>
Tue, 18 Feb 2014 03:25:10 +0000 (22:25 -0500)
committerBenjamin C Meyer <ben@meyerhome.net>
Tue, 18 Feb 2014 03:25:10 +0000 (22:25 -0500)
Issue #33

Signed-off-by: Benjamin C Meyer <ben@meyerhome.net>
git-hooks

index 2d75c8b2f1519bb3b50f820553ba521284f64e92..8ec9f13d982b4ff4a6bef238dac4665d9c20da42 100755 (executable)
--- a/git-hooks
+++ b/git-hooks
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 #
-# Copyright (c) 2010-2013, Benjamin C. Meyer <ben@meyerhome.net>
+# Copyright (c) 2010-2014, Benjamin C. Meyer <ben@meyerhome.net>
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -119,7 +119,7 @@ function install_hooks
         echo "$1 must be run inside a git repository"
         return 1
     fi
-    cd $GITDIR
+    cd "${GITDIR}"
     if [ "${1}" = "--install" ] ; then
         if [ -d hooks.old ] ; then
             echo "hooks.old already exists, perhaps you already installed?"
@@ -141,7 +141,7 @@ git-hooks run "$0" "$@"';
 function list_hooks
 {
     GITDIR=`git rev-parse --git-dir`
-    cat $GITDIR/hooks/pre-commit 2> /dev/null | grep 'git-hooks' > /dev/null 2> /dev/null
+    cat "${GITDIR}/hooks/pre-commit" 2> /dev/null | grep 'git-hooks' > /dev/null 2> /dev/null
     if [ $? = 0 ] ; then
         echo "Git hooks ARE installed in this repository."
         echo ""