summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8a3fbdd)
raw | patch | inline | side by side (parent: 8a3fbdd)
author | Jim Meyering <jim@meyering.net> | |
Sun, 11 Mar 2007 18:49:08 +0000 (19:49 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 11 Mar 2007 20:28:13 +0000 (13:28 -0700) |
a try, but all I could get was a segfault. It was dereferencing a NULL
commit list. Fix below. With it, this example now works:
$ mkdir .j; cd .j; touch f
$ git-init; git-add f; git-commit -mc f; echo x >f; git-commit -md f
$ git-diff -p :/c :/d
diff --git a/f b/f
index e69de29..587be6b 100644
--- a/f
+++ b/f
@@ -0,0 +1 @@
+x
Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
commit list. Fix below. With it, this example now works:
$ mkdir .j; cd .j; touch f
$ git-init; git-add f; git-commit -mc f; echo x >f; git-commit -md f
$ git-diff -p :/c :/d
diff --git a/f b/f
index e69de29..587be6b 100644
--- a/f
+++ b/f
@@ -0,0 +1 @@
+x
Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
sha1_name.c | patch | blob | history |
diff --git a/sha1_name.c b/sha1_name.c
index 31812d3d26c7b33eaf3fe76f3145fd1fc193366d..6b8b67b4db3cbccc13d6ddda5dd3a1be11adabd1 100644 (file)
--- a/sha1_name.c
+++ b/sha1_name.c
int get_sha1_oneline(const char *prefix, unsigned char *sha1)
{
struct commit_list *list = NULL, *backup = NULL, *l;
- struct commit *commit;
+ struct commit *commit = NULL;
if (prefix[0] == '!') {
if (prefix[1] != '!')
for_each_ref(handle_one_ref, &list);
for (l = list; l; l = l->next)
commit_list_insert(l->item, &backup);
- while ((commit = pop_most_recent_commit(&list, ONELINE_SEEN))) {
+ while (list) {
char *p;
+
+ commit = pop_most_recent_commit(&list, ONELINE_SEEN);
+ if (!commit)
+ break;
parse_object(commit->object.sha1);
if (!commit->buffer || !(p = strstr(commit->buffer, "\n\n")))
continue;