diff --git a/rev-tree.c b/rev-tree.c
index 03c900f459c0e6ae7fc9455589be00375f44eac8..c2909da1722b48be394311d9cc70cf78ec81e411 100644 (file)
--- a/rev-tree.c
+++ b/rev-tree.c
-#define _XOPEN_SOURCE /* glibc2 needs this */
-#define _BSD_SOURCE /* for tm.tm_gmtoff */
-#include <time.h>
-#include <ctype.h>
-
#include "cache.h"
#include "commit.h"
#include "cache.h"
#include "commit.h"
struct commit_list *parents;
struct commit *obj = lookup_commit(sha1);
struct commit_list *parents;
struct commit *obj = lookup_commit(sha1);
- if (obj->object.parsed)
+ if (obj && obj->object.parsed)
return;
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);
parents = obj->parents;
while (parents) {
process_commit(parents->item->object.sha1);
arg++;
basemask |= 1<<nr;
}
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++;
usage("rev-tree [--edges] [--cache <cache-file>] <commit-id> [<commit-id>]");
process_commit(sha1[nr]);
nr++;