Re: git tag -s: TAG_EDITMSG should not be deleted upon failures
From: Jeff King <hidden>
Date: 2016-06-15 22:45:44
On Sat, Dec 06, 2008 at 01:28:50PM -0800, Junio C Hamano wrote:
Thanks. I love patches that addresses bugs during -rc period.
Well, I'm not sure this was a bug fix versus an improvement, but at least wasn't an all new feature. And it was short enough to look at in one sitting. Of course, I did still manage to introduce a bug in my 4-line change...;)
- the "path" variable is uninitialized if we do not start editor at
all, so unlink(path) and free(path) have a very high chance of
failing.
I think you need [Update #1] below squashed in to fix this.Oops. Yes, that is definitely a problem.
[Update #1] [...] - char *path; + char *path = NULL;
Right, that fix looks good.
+ if (build_tag_object(buf, sign, result) < 0) {
+ if (path)
+ fprintf(stderr, "What you edited in your editor is left in %s",
+ path);
+ exit(128);
+ }Much better, though the message is a bit awkward. How about "The tag message has been left in %s" ? Do you want me to resend, or do you want to fix up locally? -Peff