[Bps-public-commit] SD branch, master, updated. c84c991f838dc6c4cd0e2c46a6ca9a92cdf03b2d

jesse jesse at bestpractical.com
Thu Aug 13 08:59:37 EDT 2009


The branch, master has been updated
       via  c84c991f838dc6c4cd0e2c46a6ca9a92cdf03b2d (commit)
       via  233ac8e5ba0061753966f0ee9a9f9d292a63c7d8 (commit)
       via  77ce50e93b87ff3efe9028b3e197b974e2b190cc (commit)
      from  f744573a696e658b08fb7a651c40fb3a207d5737 (commit)

Summary of changes:
 bin/git-sd |   33 +++++++++++++++------------------
 1 files changed, 15 insertions(+), 18 deletions(-)

- Log -----------------------------------------------------------------
commit 77ce50e93b87ff3efe9028b3e197b974e2b190cc
Author: Arjen Laarhoven <arjen at yaph.org>
Date:   Thu Aug 6 22:06:01 2009 +0100

    git-sd: Support paths with spaces in them
    
    Use correct shell variabele quoting to handle paths with spaces in them
    correctly.

diff --git a/bin/git-sd b/bin/git-sd
index 026a135..cb6b512 100755
--- a/bin/git-sd
+++ b/bin/git-sd
@@ -1,8 +1,8 @@
 #!/bin/sh
 
 replica=`git config --get sd.local-replica`
-if [ -z $replica ]; then
-    if [ -z $GIT_DIR ] ; then # GIT_DIR Not defined
+if [ -z "$replica" ]; then
+    if [ -z "$GIT_DIR" ] ; then # GIT_DIR Not defined
         gitdir=`pwd`
         while ! [ -e "$gitdir/.git" ]; do
             if [ "$gitdir" = "/" ]; then
@@ -13,15 +13,15 @@ if [ -z $replica ]; then
             gitdir=`dirname $gitdir`
         done
     else
-        gitdir=$GIT_DIR
+        gitdir="$GIT_DIR"
     fi
 
-    replica=$gitdir/.git/sd
+    replica="$gitdir/.git/sd"
     echo "You don't appear to have an sd.local-replica defined in your .git/config"
     echo "Setting it to '$replica':"
     echo ""
     echo "  git config --add sd.local-replica $replica"
-    git config --add sd.local-replica $replica
+    git config --add sd.local-replica "$replica"
 fi
 
-SD_REPO=$replica exec sd $@
+SD_REPO="$replica" exec sd "$@"

commit 233ac8e5ba0061753966f0ee9a9f9d292a63c7d8
Author: Arjen Laarhoven <arjen at yaph.org>
Date:   Thu Aug 6 22:46:26 2009 +0100

    git-sd: Clean up the git-dir search
    
    The search for a .git directory was done programmatically, while the
    git-rev-parse command has the --git-dir option to perform this
    operation.

diff --git a/bin/git-sd b/bin/git-sd
index cb6b512..91ef19a 100755
--- a/bin/git-sd
+++ b/bin/git-sd
@@ -2,21 +2,18 @@
 
 replica=`git config --get sd.local-replica`
 if [ -z "$replica" ]; then
-    if [ -z "$GIT_DIR" ] ; then # GIT_DIR Not defined
-        gitdir=`pwd`
-        while ! [ -e "$gitdir/.git" ]; do
-            if [ "$gitdir" = "/" ]; then
-                echo "Can't find a .git directory anywhere in your current directory"
-                echo "or any higher directories."
-                exit 1;
-            fi
-            gitdir=`dirname $gitdir`
-        done
-    else
-        gitdir="$GIT_DIR"
+    gitdir=$(git rev-parse --git-dir 2>/dev/null)
+    if [ -z "$gitdir" ]; then
+	echo "Can't find a .git directory anywhere in your current directory"
+	echo "or any higher directories."
+	exit 1;
     fi
-
-    replica="$gitdir/.git/sd"
+    # Special case: when in the toplevel directory, rev-parse --git-dir only
+    # returns '.git' instead of the full path.
+    if [ "$gitdir" = ".git" ]; then
+	gitdir="$(pwd)/.git"
+    fi
+    replica="$gitdir/sd"
     echo "You don't appear to have an sd.local-replica defined in your .git/config"
     echo "Setting it to '$replica':"
     echo ""

commit c84c991f838dc6c4cd0e2c46a6ca9a92cdf03b2d
Author: Arjen Laarhoven <arjen at yaph.org>
Date:   Thu Aug 6 22:56:39 2009 +0100

    git-sd: Use the $() form of command substitution

diff --git a/bin/git-sd b/bin/git-sd
index 91ef19a..cfd7f87 100755
--- a/bin/git-sd
+++ b/bin/git-sd
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-replica=`git config --get sd.local-replica`
+replica=$(git config --get sd.local-replica)
 if [ -z "$replica" ]; then
     gitdir=$(git rev-parse --git-dir 2>/dev/null)
     if [ -z "$gitdir" ]; then

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list