diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-02-10 14:07:58 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-02-10 14:07:58 -0800 |
commit | d88698ec0b4b91e61b0fe3e00d7451abcdf4cd44 (patch) | |
tree | cefb3bd2ea1ca666a7be7c80ad052785fd8d2c71 /t | |
parent | e684e89ef00e229c9fc6e7d53264fb03d4732d4c (diff) | |
parent | c2d17ba3db0d2b14daf04e69a8c5ec73b023c1fe (diff) | |
download | git-d88698ec0b4b91e61b0fe3e00d7451abcdf4cd44.tar.gz |
Merge branch 'jc/branch-desc-typoavoidance'
* jc/branch-desc-typoavoidance:
branch --edit-description: protect against mistyped branch name
Diffstat (limited to 't')
-rwxr-xr-x | t/t3200-branch.sh | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index ea82424e47..dd1acebd88 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 \ @@ -620,4 +617,40 @@ 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_done |