Do not report size of the object that cannot be written in local-pull.c
[gitweb.git] / rev-tree.c
index c3884e3595cd00f8c1108429060ed195f7506514..bfc8b125794d5c7104ed955eb3021c5958fc11b5 100644 (file)
@@ -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"
 
@@ -55,6 +50,10 @@ void process_commit(unsigned char *sha1)
 {
        struct commit_list *parents;
        struct commit *obj = lookup_commit(sha1);
+
+       if (obj->object.parsed)
+               return;
+
        parse_commit(obj);
        
        parents = obj->parents;
@@ -85,8 +84,7 @@ int main(int argc, char **argv)
                char *arg = argv[i];
 
                if (!strcmp(arg, "--cache")) {
-                       read_cache_file(argv[2]);
-                       i++;
+                       read_cache_file(argv[++i]);
                        continue;
                }
 
@@ -99,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++;