summaryrefslogtreecommitdiff
path: root/fsck-cache.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-09 13:02:30 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-09 13:02:30 -0700
commit16d4d1ba6c1de7a414a6826eb6f363d4b20345bf (patch)
tree5319e4d609cdd282069cc4dce33c1db559539b03 /fsck-cache.c
parent9174026cfe69d73ef80b27890615f8b2ef5c265a (diff)
downloadgit-16d4d1ba6c1de7a414a6826eb6f363d4b20345bf.tar.gz
Make "fsck-cache" print out all the root commits it finds.
Once I do the reference tracking, I'll also make it print out all the HEAD commits it finds, which is even more interesting.
Diffstat (limited to 'fsck-cache.c')
-rw-r--r--fsck-cache.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fsck-cache.c b/fsck-cache.c
index a01513ed4d..ac348b7d52 100644
--- a/fsck-cache.c
+++ b/fsck-cache.c
@@ -35,6 +35,7 @@ static int fsck_tree(unsigned char *sha1, void *data, unsigned long size)
static int fsck_commit(unsigned char *sha1, void *data, unsigned long size)
{
+ int parents;
unsigned char tree_sha1[20];
unsigned char parent_sha1[20];
@@ -44,12 +45,16 @@ static int fsck_commit(unsigned char *sha1, void *data, unsigned long size)
return -1;
mark_needs_sha1(sha1, "tree", tree_sha1);
data += 5 + 40 + 1; /* "tree " + <hex sha1> + '\n' */
+ parents = 0;
while (!memcmp(data, "parent ", 7)) {
if (get_sha1_hex(data + 7, parent_sha1) < 0)
return -1;
mark_needs_sha1(sha1, "commit", parent_sha1);
data += 7 + 40 + 1; /* "parent " + <hex sha1> + '\n' */
+ parents++;
}
+ if (!parents)
+ printf("root: %s\n", sha1_to_hex(sha1));
return 0;
}