X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft3200-branch.sh;h=9fe1d8feab419e1a8065b2ea5881f991edc68855;hb=f629c233e6dd72924ed2672db142708b71dc663e;hp=76903323af37ed1a96b5a11c27eb1e9d63a0e9ef;hpb=5a6a9394814273e88124a5576c0be6d37a1262cc;p=git.git diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 76903323a..9fe1d8fea 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -3,11 +3,8 @@ # Copyright (c) 2005 Amos Waterland # -test_description='git branch --foo should not create bogus branch +test_description='git branch assorted tests' -This test runs git branch --help and checks that the argument is properly -handled. Specifically, that a bogus branch is not created. -' . ./test-lib.sh test_expect_success \ @@ -22,7 +19,7 @@ test_expect_success \ test_expect_success \ 'git branch --help should not have created a bogus branch' ' - git branch --help /dev/null 2>/dev/null; + test_might_fail git branch --help /dev/null 2>/dev/null && test_path_is_missing .git/refs/heads/--help ' @@ -88,7 +85,7 @@ test_expect_success \ test_expect_success \ 'git branch -m n/n n should work' \ 'git branch -l n/n && - git branch -m n/n n + git branch -m n/n n && test_path_is_file .git/logs/refs/heads/n' test_expect_success 'git branch -m o/o o should fail when o/p exists' ' @@ -620,4 +617,44 @@ test_expect_success 'use set-upstream on the current branch' ' ' +test_expect_success 'use --edit-description' ' + write_script editor <<-\EOF && + echo "New contents" >"$1" + EOF + EDITOR=./editor git branch --edit-description && + write_script editor <<-\EOF && + git stripspace -s <"$1" >"EDITOR_OUTPUT" + EOF + EDITOR=./editor git branch --edit-description && + echo "New contents" >expect && + test_cmp EDITOR_OUTPUT expect +' + +test_expect_success 'detect typo in branch name when using --edit-description' ' + write_script editor <<-\EOF && + echo "New contents" >"$1" + EOF + ( + EDITOR=./editor && + export EDITOR && + test_must_fail git branch --edit-description no-such-branch + ) +' + +test_expect_success 'refuse --edit-description on unborn branch for now' ' + write_script editor <<-\EOF && + echo "New contents" >"$1" + EOF + git checkout --orphan unborn && + ( + EDITOR=./editor && + export EDITOR && + test_must_fail git branch --edit-description + ) +' + +test_expect_success '--merged catches invalid object names' ' + test_must_fail git branch --merged 0000000000000000000000000000000000000000 +' + test_done