Fix and improve t7004 (git-tag tests)
Brown paper bag fix to avoid using non portable sed syntax. The test by itself didn't catch what it was supposed to, anyways. The new test first checks if git-tag correctly errors out when the user exited the editor without editing the file. Then it checks if what the user was presented in the editor was any useful, which we define as the following: * It begins with a single blank line, where the invoked editor would typically place the editing curser at, so that the user can immediately start typing; * It has some instruction but that comes after that initial blank line, all lines prefixed with "#". We specifically do not check for the wording of this instruction. * And it has nothing else, as the expected behaviour is "Hey you did not leave any message". Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
347989f4ea
commit
eb9d2b91cf
@ -1004,10 +1004,20 @@ test_expect_failure \
|
||||
'verify signed tag fails when public key is not present' \
|
||||
'git-tag -v signed-tag'
|
||||
|
||||
test_expect_failure \
|
||||
'git-tag -a fails if tag annotation is empty' '
|
||||
GIT_EDITOR=cat git tag -a initial-comment
|
||||
'
|
||||
|
||||
test_expect_success \
|
||||
'message in editor has initial comment' '
|
||||
GIT_EDITOR=cat git tag -a initial-comment > actual || true &&
|
||||
test $(sed -n "/^\(#\|\$\)/p" actual | wc -l) -gt 0
|
||||
GIT_EDITOR=cat git tag -a initial-comment > actual
|
||||
# check the first line --- should be empty
|
||||
first=$(sed -e 1q <actual) &&
|
||||
test -z "$first" &&
|
||||
# remove commented lines from the remainder -- should be empty
|
||||
rest=$(sed -e 1d -e '/^#/d' <actual) &&
|
||||
test -z "$rest"
|
||||
'
|
||||
|
||||
get_tag_header reuse $commit commit $time >expect
|
||||
|
Loading…
Reference in New Issue
Block a user