Try to make test output look better
[git.git] / rev-tree.c
index 95ec274..c2909da 100644 (file)
@@ -51,11 +51,11 @@ void process_commit(unsigned char *sha1)
        struct commit_list *parents;
        struct commit *obj = lookup_commit(sha1);
 
-       if (obj->object.parsed)
+       if (obj && obj->object.parsed)
                return;
+       if (!obj || parse_commit(obj))
+               die("unable to parse commit (%s)", sha1_to_hex(sha1));
 
-       parse_commit(obj);
-       
        parents = obj->parents;
        while (parents) {
                process_commit(parents->item->object.sha1);
@@ -97,7 +97,7 @@ int main(int argc, char **argv)
                        arg++;
                        basemask |= 1<<nr;
                }
-               if (nr >= MAX_COMMITS || get_sha1_hex(arg, sha1[nr]))
+               if (nr >= MAX_COMMITS || get_sha1(arg, sha1[nr]))
                        usage("rev-tree [--edges] [--cache <cache-file>] <commit-id> [<commit-id>]");
                process_commit(sha1[nr]);
                nr++;