projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleanup the x-allocation functions
[git.git]
/
rev-tree.c
diff --git
a/rev-tree.c
b/rev-tree.c
index
c3884e3
..
c2909da
100644
(file)
--- a/
rev-tree.c
+++ b/
rev-tree.c
@@
-1,8
+1,3
@@
-#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"
@@
-55,8
+50,12
@@
void process_commit(unsigned char *sha1)
{
struct commit_list *parents;
struct commit *obj = lookup_commit(sha1);
{
struct commit_list *parents;
struct commit *obj = lookup_commit(sha1);
- parse_commit(obj);
-
+
+ if (obj && obj->object.parsed)
+ return;
+ if (!obj || parse_commit(obj))
+ die("unable to parse commit (%s)", sha1_to_hex(sha1));
+
parents = obj->parents;
while (parents) {
process_commit(parents->item->object.sha1);
parents = obj->parents;
while (parents) {
process_commit(parents->item->object.sha1);
@@
-85,8
+84,7
@@
int main(int argc, char **argv)
char *arg = argv[i];
if (!strcmp(arg, "--cache")) {
char *arg = argv[i];
if (!strcmp(arg, "--cache")) {
- read_cache_file(argv[2]);
- i++;
+ read_cache_file(argv[++i]);
continue;
}
continue;
}
@@
-99,7
+97,7
@@
int main(int argc, char **argv)
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++;