[PATCH] git-fsck-cache: Gracefully handle non-commit IDs
[git.git] / rev-tree.c
index c3884e3..03c900f 100644 (file)
@@ -55,6 +55,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 +89,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;
                }