Code

tag: delete TAG_EDITMSG only on successful tag
authorJeff King <peff@peff.net>
Sat, 6 Dec 2008 19:40:34 +0000 (14:40 -0500)
committerJunio C Hamano <gitster@pobox.com>
Sun, 7 Dec 2008 10:53:45 +0000 (02:53 -0800)
commit3927bbe9a4d4033551dea39ac1abb9cdc45d822c
tree9d8b8febf7e195e1cf76c704419c00b1b4e49da1
parentbcc6a833032e0830195c1de1b834006a1d0156fe
tag: delete TAG_EDITMSG only on successful tag

The user may put some effort into writing an annotated tag
message. When the tagging process later fails (which can
happen fairly easily, since it may be dependent on gpg being
correctly configured and used), there is no record left on
disk of the tag message.

Instead, let's keep the TAG_EDITMSG file around until we are
sure the tag has been created successfully. If we die
because of an error, the user can recover their text from
that file. Leaving the file in place causes no conflicts;
it will be silently overwritten by the next annotated tag
creation.

This matches the behavior of COMMIT_EDITMSG, which stays
around in case of error.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-tag.c