[Bps-public-commit] SD branch, master, updated. 0.73-39-g21b6423

spang at bestpractical.com spang at bestpractical.com
Sat Jan 9 18:18:08 EST 2010


The branch, master has been updated
       via  21b642339593273e7be3ab9b6eb9ba429f27ba0e (commit)
       via  e952ce11ccb158108ff9ae32544d1964b9f5329e (commit)
      from  933ae5a5dd84fc324f4a430576fe2af22e0d81f8 (commit)

Summary of changes:
 bin/git-sd                   |   16 +++++++++-------
 lib/App/SD/CLI/Dispatcher.pm |    3 ++-
 2 files changed, 11 insertions(+), 8 deletions(-)

- Log -----------------------------------------------------------------
commit e952ce11ccb158108ff9ae32544d1964b9f5329e
Author: Christine Spang <spang at bestpractical.com>
Date:   Sat Jan 9 17:49:45 2010 -0500

    Allow using the -h flag without having SD_REPO set

diff --git a/lib/App/SD/CLI/Dispatcher.pm b/lib/App/SD/CLI/Dispatcher.pm
index b063feb..7102025 100644
--- a/lib/App/SD/CLI/Dispatcher.pm
+++ b/lib/App/SD/CLI/Dispatcher.pm
@@ -74,7 +74,8 @@ on help => run_command('Help');
 on qr'.*' => sub {
     my $self = shift;
 
-    unless ( $self->cli->app_handle->local_replica_url ) {
+    unless ( $self->cli->app_handle->local_replica_url ||
+        $self->cli->context->has_arg('h') ) {
 
         print join "\n",
             "",

commit 21b642339593273e7be3ab9b6eb9ba429f27ba0e
Author: Christine Spang <spang at bestpractical.com>
Date:   Sat Jan 9 18:14:00 2010 -0500

    some cleanups and improvements for git-sd
    
    * Don't use crazy escaped parens.
    * use -n instead of ! -z
    * Always quots vars in tests or commands
    * Don't grab the email from git and set it in sd if using the -h or
      --help switches, or if the replica config already exists. (Allows
      having an email different from the git email if wanted.)

diff --git a/bin/git-sd b/bin/git-sd
index 71f566b..181fec3 100755
--- a/bin/git-sd
+++ b/bin/git-sd
@@ -1,6 +1,5 @@
 #!/bin/sh
 
-sdsetup=0
 replica=$(git config --get sd.local-replica)
 if [ -z "$replica" ]; then
     gitdir=$(git rev-parse --git-dir 2>/dev/null)
@@ -21,21 +20,24 @@ if [ -z "$replica" ]; then
     echo "  git config --add sd.local-replica $replica"
     echo ""
     git config --add sd.local-replica "$replica"
-    sdsetup=1
 fi
 
-if [ \( "$1" = "init" \) -o \( "$1" = "clone" \) ]; then
+if [ "$1" = "init" ] || [ "$1" = "clone" ] && [ "$2" != "-h" ] \
+    && [ "$2" != "--help" ]; then
     gitemail=$(git config --get user.email)
-    if [ ! -z $gitemail ]; then
+    # It shouldn't happen very often that we're using init or clone from
+    # an already-existing db, but don't mess around with peoples' configs
+    # once they've already been created anyway.
+    if [ -n "$gitemail" ] && [ ! -e "$replica/config" ]; then
         echo "Setting your SD email address to your git email:"
         echo ""
         echo "  git config --get user.email"
-        if [ ! -d $replica ]; then
-            mkdir $replica
+        if [ ! -d "$replica" ]; then
+            mkdir "$replica"
         fi
         echo "  sd config user.email-address $gitemail"
         echo ""
-        SD_REPO="$replica" sd config user.email-address $gitemail
+        SD_REPO="$replica" sd config user.email-address "$gitemail"
     fi
 fi
 

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



More information about the Bps-public-commit mailing list