X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=fsck-cache.c;h=f9b1431dd8f4f3b426a7e410de952277aaa11401;hb=812666c8e66a21e668c0789d0422aa5a7db54961;hp=a83266ce2f3bd5b3ed8dae1e720825b9d9a4aadb;hpb=889262eacf43a7a8810c288c00732b9134d79630;p=git.git diff --git a/fsck-cache.c b/fsck-cache.c index a83266ce..f9b1431d 100644 --- a/fsck-cache.c +++ b/fsck-cache.c @@ -9,6 +9,7 @@ #define REACHABLE 0x0001 +static int show_root = 0; static int show_tags = 0; static int show_unreachable = 0; static unsigned char head_sha1[20]; @@ -56,7 +57,7 @@ static int fsck_commit(unsigned char *sha1, void *data, unsigned long size) return -1; if (!commit->tree) return -1; - if (!commit->parents) + if (!commit->parents && show_root) printf("root %s\n", sha1_to_hex(sha1)); if (!commit->date) printf("bad commit date in %s\n", sha1_to_hex(sha1)); @@ -203,6 +204,10 @@ int main(int argc, char **argv) show_tags = 1; continue; } + if (!strcmp(arg, "--root")) { + show_root = 1; + continue; + } if (*arg == '-') usage("fsck-cache [--tags] [[--unreachable] *]"); }