better error handling (thanks Joseph Liu)
authorMike O'Connor <stew@vireo.org>
Sun, 30 Oct 2011 12:32:58 +0000 (08:32 -0400)
committerMike O'Connor <stew@vireo.org>
Sun, 30 Oct 2011 12:32:58 +0000 (08:32 -0400)
Signed-off-by: Mike O'Connor <stew@vireo.org>
movein

diff --git a/movein b/movein
index 3322bd2..233f886 100755 (executable)
--- a/movein
+++ b/movein
@@ -177,7 +177,7 @@ add() {
             echo $LOCAL_REPO already exists
             exit 1
         else
             echo $LOCAL_REPO already exists
             exit 1
         else
-            trap "rm -rf $LOCAL_REPO" 0
+            trap "unset GIT_DIR; unset GIT_WORK_TREE; rm -rf $LOCAL_REPO" 0
             mkdir "$LOCAL_REPO"
             export GIT_DIR="$LOCAL_REPO"
             git init --bare
             mkdir "$LOCAL_REPO"
             export GIT_DIR="$LOCAL_REPO"
             git init --bare
@@ -232,7 +232,7 @@ new() {
         echo $LOCAL_REPO already exists
         exit 1
     else
         echo $LOCAL_REPO already exists
         exit 1
     else
-        trap "rm -rf $LOCAL_REPO" 0
+        trap "unset GIT_DIR; unset GIT_WORK_TREE; rm -rf $LOCAL_REPO" 0
         mkdir -p "$LOCAL_REPO"
 
         ssh $GIT_HOST "
         mkdir -p "$LOCAL_REPO"
 
         ssh $GIT_HOST "