"git fmt-merge-msg" SIGSEGV
Ok, this is a _really_ stupid case, and I don't think it matters, but hey, we should never SIGSEGV. Steps to reproduce: mkdir duh cd duh git init-db git-fmt-merge-msg < /dev/null will cause a SIGSEGV in cmd_fmt_merge_msg(), because we're doing a strncmp() with a NULL current_branch. And yeah, it's an insane schenario, and no, it doesn't really matter. The only reason I noticed was that a broken version of my "git pull" into an empty directory would cause this. This silly patch just replaces the SIGSEGV with a controlled exit with an error message. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Linus Torvalds committed
Nov 16, 2006 at 22:57 UTC
6b1f8c32b1a602734f14b9cf8a9f59a767752677
1 file changed
+2
builtin-fmt-merge-msg.c
+2
@@ -278,6 +278,8 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
278
279
/* get current branch */
280
current_branch = resolve_ref("HEAD", head_sha1, 1, NULL);
281
+ if (!current_branch)
282
+ die("No current branch");
283
if (!strncmp(current_branch, "refs/heads/", 11))
284
current_branch += 11;
285