aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-25 16:34:13 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-25 16:34:13 -0700
commitab7df1874d87d3f7494397442e67e900b580a346 (patch)
tree635e855bb4a37467811de46f5fc17c18184a636c
parent889262eacf43a7a8810c288c00732b9134d79630 (diff)
downloadgit-ab7df1874d87d3f7494397442e67e900b580a346.tar.gz
git-ab7df1874d87d3f7494397442e67e900b580a346.tar.xz
fsck-cache: show root objects only with "--root"
This makes the default fsck behaviour be quiet for a repository that doesn't have any problems. Which is good.
-rw-r--r--fsck-cache.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fsck-cache.c b/fsck-cache.c
index a83266ce2..f9b1431dd 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] <head-sha1>*]");
}