diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-06-13 22:29:44 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-06-13 22:29:44 +0300 |
commit | 6d2a88c7289b56999426354f44b536255b57c5c8 (patch) | |
tree | 0dadd5518aea1ce4df5dbc9bcb3827e38645bfb8 /t | |
parent | fe86abd7511a9a6862d5706c6fa1d9b57a63ba09 (diff) | |
parent | 08c12ec1d0444c9ea7cf24b7157aa158f3f641f4 (diff) |
Merge branch 'kh/keep-tag-editmsg-upon-failure'
"git tag" learned to leave the "$GIT_DIR/TAG_EDITMSG" file when the
command failed, so that the user can salvage what they typed.
* kh/keep-tag-editmsg-upon-failure:
tag: keep the message file in case ref transaction fails
t/t7004-tag: add regression test for successful tag creation
doc: tag: document `TAG_EDITMSG`
Diffstat (limited to 't')
-rwxr-xr-x | t/t7004-tag.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index 0fe6ba93a2..e689db4292 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -2188,4 +2188,23 @@ test_expect_success 'Does --[no-]contains stop at commits? Yes!' ' test_cmp expected actual ' +test_expect_success 'If tag is created then tag message file is unlinked' ' + test_when_finished "git tag -d foo" && + write_script fakeeditor <<-\EOF && + echo Message >.git/TAG_EDITMSG + EOF + GIT_EDITOR=./fakeeditor git tag -a foo && + test_path_is_missing .git/TAG_EDITMSG +' + +test_expect_success 'If tag cannot be created then tag message file is not unlinked' ' + test_when_finished "git tag -d foo/bar && rm .git/TAG_EDITMSG" && + write_script fakeeditor <<-\EOF && + echo Message >.git/TAG_EDITMSG + EOF + git tag foo/bar && + test_must_fail env GIT_EDITOR=./fakeeditor git tag -a foo && + test_path_exists .git/TAG_EDITMSG +' + test_done |