Merge branch 'rr/for-each-ref-decoration'
[gitweb.git] / commit.c
index de16a3c0a2d6693173678247ba0755e4d7483a1c..11509ffc471c548a1367068b3d7c2f15d19361f4 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -79,7 +79,7 @@ struct commit *lookup_commit_reference_by_name(const char *name)
        if (get_sha1_committish(name, sha1))
                return NULL;
        commit = lookup_commit_reference(sha1);
-       if (!commit || parse_commit(commit))
+       if (parse_commit(commit))
                return NULL;
        return commit;
 }
@@ -341,6 +341,13 @@ int parse_commit(struct commit *item)
        return ret;
 }
 
+void parse_commit_or_die(struct commit *item)
+{
+       if (parse_commit(item))
+               die("unable to parse commit %s",
+                   item ? sha1_to_hex(item->object.sha1) : "(null)");
+}
+
 int find_commit_subject(const char *commit_buffer, const char **subject)
 {
        const char *eol;