summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d09e79c)
raw | patch | inline | side by side (parent: d09e79c)
author | Linus Torvalds <torvalds@osdl.org> | |
Fri, 17 Nov 2006 06:57:20 +0000 (22:57 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Fri, 17 Nov 2006 07:45:57 +0000 (23:45 -0800) |
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>
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>
builtin-fmt-merge-msg.c | patch | blob | history |
index 3d3097d299d4c964e1acfff7a365501a8bd53587..87d3d63ec71ec7f08127085330d28ed28e3f35c7 100644 (file)
--- a/builtin-fmt-merge-msg.c
+++ b/builtin-fmt-merge-msg.c
/* get current branch */
current_branch = resolve_ref("HEAD", head_sha1, 1, NULL);
+ if (!current_branch)
+ die("No current branch");
if (!strncmp(current_branch, "refs/heads/", 11))
current_branch += 11;