diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-12-28 23:32:33 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-12-28 23:32:33 +0400 |
commit | 79587741cbed7704d2e7213c999cf2841af3000d (patch) | |
tree | ac065e7bd784619dbc5cc47e543860b57f71adb3 /t | |
parent | e39888ba21b68888e1db2d989155f23ea78fc842 (diff) | |
parent | 39bd6f726109942c6f77f59638f6763c9f00706c (diff) |
Merge branch 'jn/branch-move-to-self' into maint
* jn/branch-move-to-self:
Allow checkout -B <current-branch> to update the current branch
branch: allow a no-op "branch -M <current-branch> HEAD"
Diffstat (limited to 't')
-rwxr-xr-x | t/t2018-checkout-branch.sh | 9 | ||||
-rwxr-xr-x | t/t3200-branch.sh | 16 |
2 files changed, 21 insertions, 4 deletions
diff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh index 75874e85df..2741262369 100755 --- a/t/t2018-checkout-branch.sh +++ b/t/t2018-checkout-branch.sh @@ -189,12 +189,13 @@ test_expect_success 'checkout -b <describe>' ' test_cmp expect actual ' -test_expect_success 'checkout -B to the current branch fails before merging' ' +test_expect_success 'checkout -B to the current branch works' ' git checkout branch1 && + git checkout -B branch1-scratch && + setup_dirty_mergeable && - git commit -mfooble && - test_must_fail git checkout -B branch1 initial && - test_must_fail test_dirty_mergeable + git checkout -B branch1-scratch initial && + test_dirty_mergeable ' test_done diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index bc73c2099b..76903323af 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -115,6 +115,22 @@ test_expect_success 'git branch -M baz bam should succeed when baz is checked ou git branch -M baz bam ' +test_expect_success 'git branch -M master should work when master is checked out' ' + git checkout master && + git branch -M master +' + +test_expect_success 'git branch -M master master should work when master is checked out' ' + git checkout master && + git branch -M master master +' + +test_expect_success 'git branch -M master2 master2 should work when master is checked out' ' + git checkout master && + git branch master2 && + git branch -M master2 master2 +' + test_expect_success 'git branch -v -d t should work' ' git branch t && test_path_is_file .git/refs/heads/t && |