X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=rev-tree.c;h=bc190ebc71bbd923f2b728e505408f5e54bd073a;hb=d6db01075b65da2b8584a0450619390893aae103;hp=95ec274fc7fa68d2e70446104c51732ac7815fe2;hpb=5e7921e7c1a844974469a5f865ebf0001ff06311;p=git.git diff --git a/rev-tree.c b/rev-tree.c index 95ec274f..bc190ebc 100644 --- a/rev-tree.c +++ b/rev-tree.c @@ -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 ] [] + * Usage: git-rev-tree [--edges] [--cache ] [] * * The cache-file can be quite important for big trees. This is an * expensive operation if you have to walk the whole chain of @@ -97,8 +97,8 @@ int main(int argc, char **argv) arg++; basemask |= 1<= MAX_COMMITS || get_sha1_hex(arg, sha1[nr])) - usage("rev-tree [--edges] [--cache ] []"); + if (nr >= MAX_COMMITS || get_sha1(arg, sha1[nr])) + usage("git-rev-tree [--edges] [--cache ] []"); process_commit(sha1[nr]); nr++; }