aboutsummaryrefslogtreecommitdiff
path: root/t/t3200-branch.sh
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@elego.de>2012-08-30 19:23:12 +0200
committerJunio C Hamano <gitster@pobox.com>2012-08-30 12:07:28 -0700
commitb84869ef14081b298a4ab825219221ccfcb2a3ba (patch)
tree6fea49e42eb35e4e8d5e826b2e9f0c37597faafd /t/t3200-branch.sh
parent6183d826ba62ec94ccfcb8f6e3b8d43e3e338703 (diff)
downloadgit-b84869ef14081b298a4ab825219221ccfcb2a3ba.tar.gz
git-b84869ef14081b298a4ab825219221ccfcb2a3ba.tar.xz
branch: add --unset-upstream option
We have ways of setting the upstream information, but if we want to unset it, we need to resort to modifying the configuration manually. Teach branch an --unset-upstream option that unsets this information. Signed-off-by: Carlos Martín Nieto <cmn@elego.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3200-branch.sh')
-rwxr-xr-xt/t3200-branch.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index e9019ac94..0bf72d206 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -383,6 +383,28 @@ test_expect_success 'use --set-upstream-to modify a particular branch' \
test "$(git config branch.my13.remote)" = "." &&
test "$(git config branch.my13.merge)" = "refs/heads/master"'
+test_expect_success '--unset-upstream should fail if given a non-existent branch' \
+ 'test_must_fail git branch --unset-upstream i-dont-exist'
+
+test_expect_success 'test --unset-upstream on HEAD' \
+ 'git branch my14
+ test_config branch.master.remote foo &&
+ test_config branch.master.merge foo &&
+ git branch --set-upstream-to my14 &&
+ git branch --unset-upstream &&
+ test_must_fail git config branch.master.remote &&
+ test_must_fail git config branch.master.merge &&
+ # fail for a branch without upstream set
+ test_must_fail git branch --unset-upstream
+'
+
+test_expect_success 'test --unset-upstream on a particular branch' \
+ 'git branch my15
+ git branch --set-upstream-to master my14 &&
+ git branch --unset-upstream my14 &&
+ test_must_fail git config branch.my14.remote &&
+ test_must_fail git config branch.my14.merge'
+
# Keep this test last, as it changes the current branch
cat >expect <<EOF
$_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master