>From ef4d4081474bd9925b60c2ab856260d9174220b9 Mon Sep 17 00:00:00 2001
From: mhart <mich...@adslot.com>
Date: Sun, 16 Oct 2011 00:16:53 +1100
Subject: [PATCH 07/19] Added check to ensure that split succeeds before trying
 to push

---
 contrib/subtree/git-subtree.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 8056851..ae9f87f 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -754,7 +754,12 @@ cmd_push()
         refspec=$(git config -f .gittrees subtree.$prefix.branch)
       fi
            echo "git push using: " $repository $refspec
-           git push $repository $(git subtree split
--prefix=$prefix):refs/heads/$refspec
+           rev=$(git subtree split --prefix=$prefix)
+           if [ -n "$rev" ]; then
+               git push $repository $rev:refs/heads/$refspec
+           else
+               die "Couldn't push, 'git subtree split' failed."
+           fi
        else
            die "'$dir' must already exist. Try 'git subtree add'."
        fi
-- 
1.8.2.rc1

-- 
Paul [W] Campbell
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to