]> git.droids-corp.org - git-central.git/commitdiff
Fix missing -r in gc-checkout looking for existing tracking branches.
authorStephen Haberman <stephen@exigencecorp.com>
Tue, 26 Aug 2008 19:26:21 +0000 (14:26 -0500)
committerStephen Haberman <stephen@exigencecorp.com>
Tue, 26 Aug 2008 19:26:21 +0000 (14:26 -0500)
scripts/gc-checkout
tests/t5000-script-checkout.sh

index cdc5ab9067272d76a7e2127356d9558b67089f6e..5f50c26bd3b7fb16cfdec21d8297a9a9b22a5ebf 100644 (file)
@@ -3,14 +3,14 @@
 branch_name=$1
 
 # See if it already exists
-git rev-parse $branch_name >/dev/null
+git rev-parse --verify --quiet $branch_name >/dev/null 
 if [[ $? -eq 0 ]] ; then
        # Just checkout what they asked
        git checkout "$branch_name"
 else
        # Make sure we have the latest origin/$branch_name to branch
        git fetch
-       exists_remote=$(git branch | grep -x "  origin/$branch_name" | wc -l)
+       exists_remote=$(git branch -r | grep -x "  origin/$branch_name" | wc -l)
        if [[ $exists_remote -eq 0 ]] ; then
                # Specifying stable to get the last released code
                git checkout -b "$branch_name" origin/stable
index f162189b9585dd93d8f33344381ac92eed2a16ff..c9ce960915ee2308ddeca5b4d8407bc946fa1eeb 100644 (file)
@@ -27,14 +27,19 @@ test_expect_success 'checkout a new branch clones stable' '
 test_expect_success 'checkout an existing remote branch' '
        cd server &&
        git checkout -b topic2 stable &&
-       echo "$test_name" >a &&
+       echo "$test_name on server" >a &&
        git commit -a -m "Made topic2 on server" &&
        cd .. &&
 
-       gc-checkout topic2
-       git branch | grep topic2
-       git branch -r | grep origin/topic2
-       git config --list | grep "branch.topic2.merge=refs/heads/topic2"
+       ! git branch | grep topic2 &&
+       gc-checkout topic2 &&
+       git branch | grep topic2 &&
+       git branch -r | grep origin/topic2 &&
+       git config --list | grep "branch.topic2.merge=refs/heads/topic2" &&
+
+       echo "$test_name on client" >a &&
+       git commit -a -m "Move topic2 on client" &&
+       git push origin topic2
 '
 
 test_expect_success 'checkout an existing local branch' '