diff-tree: don't print multiple headers for merges when silent.
[git.git] / rev-tree.c
index bfc8b12..bc190eb 100644 (file)
@@ -46,16 +46,16 @@ static int interesting(struct commit *rev)
        return 1;
 }
 
-void process_commit(unsigned char *sha1)
+static 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);
@@ -64,7 +64,7 @@ void process_commit(unsigned char *sha1)
 }
 
 /*
- * Usage: rev-tree [--edges] [--cache <cache-file>] <commit-id> [<commit-id2>]
+ * Usage: git-rev-tree [--edges] [--cache <cache-file>] <commit-id> [<commit-id2>]
  *
  * The cache-file can be quite important for big trees. This is an
  * expensive operation if you have to walk the whole chain of
@@ -98,7 +98,7 @@ int main(int argc, char **argv)
                        basemask |= 1<<nr;
                }
                if (nr >= MAX_COMMITS || get_sha1(arg, sha1[nr]))
-                       usage("rev-tree [--edges] [--cache <cache-file>] <commit-id> [<commit-id>]");
+                       usage("git-rev-tree [--edges] [--cache <cache-file>] <commit-id> [<commit-id>]");
                process_commit(sha1[nr]);
                nr++;
        }