Update the verify_tag() function to remove an unnecessary test, and add
additional check for angle brackets in the name and email field, and
spaces in the email field. The timestamp and timezone sections are made
more straight forward by using strspn().
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Since nearly its birth, git's tags have included a "tagger" field which
describes the name of tagger, email of tagger, and date and time of tagging.
But, this field was only loosely tested by git-mktag. Provide some thorough
testing for this field and also ensure that the tag header is separated
from the tag body by an empty line to reduce the convenience of creating
a flawed tag.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
It is a good practice to write program output to a temporary file
during the test, as it would allow easier postmortem when the tested
program does break. But there is no benefit in writing the expected
output out to the temporary.
This actually fixes a bug in check_verify_failure() routine.
The intention of the test seems to make sure the "git mktag" command
fails, and it spits out the expected error message. But if the
command did not fail as expected, the shell function as originally
written would not have detected the failure.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
There is nothing _wrong_ with egrep per se, but this way we
would have less dependency on external tools.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Not all echos know -n. This was causing a test failure in
t5401-update-hooks.sh, but not t3800-mktag.sh for some reason.
Signed-off-by: Jason Riedy <ejr@cs.berkeley.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
These changes were originally part of the next patch, but have been
split out since they were peripheral to the main purpose of that patch.
- update comment describing the signature format to reflect
the current code.
- remove trailing \n in calls to error(), since a \n is already
provided by error().
- remove redundant call to get_sha1_hex().
- call sha1_to_hex(sha1) to convert to ascii, rather than attempting
to print the raw sha1.
The new tests provide a regression suite to support the modifications
to git-mktag in this and the next patch.
Signed-off-by: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>