@matheusbsbs / matheus-bagliano / commits / 7aaa715d0a
Fork 0

fsck-objects: Remove --standalone

The fsck-objects command (back then it was called fsck-cache) used to complain if objects referred to by files in .git/refs/ or objects stored in files under .git/objects/??/ were not found as stand-alone SHA1 files (i.e. found in alternate object pools or packed archives stored under .git/objects/pack). Back then, packs and alternates were new curiosity and having everything as loose objects were the norm. When we adjusted the behaviour of fsck-cache to consider objects found in packs are OK, we introduced the --standalone flag as a backward compatibility measure. It still correctly checks if your repository is complete and consists only of loose objects, so in that sense it is doing the "right" thing, but checking that is pointless these days. This commit removes --standalone flag. See also: 23676d407c63a6f67f8ce3ff192199bda03e6a03 8a498a05c3c6b2f53db669b24f36257ab213eb4c Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Mar 9, 2006 at 01:44 UTC 7aaa715d0abb12067504af08919197a67a68aca7
2 files changed +9 -26
Documentation/git-fsck-objects.txt
+4 -11
@@ -10,7 +10,7 @@ SYNOPSIS
10 --------
11 [verse]
12 'git-fsck-objects' [--tags] [--root] [--unreachable] [--cache]
13 - [--standalone | --full] [--strict] [<object>*]
13 + [--full] [--strict] [<object>*]
14
15 DESCRIPTION
16 -----------
@@ -38,21 +38,14 @@ index file and all SHA1 references in .git/refs/* as heads.
38 Consider any object recorded in the index also as a head node for
39 an unreachability trace.
40
41 ---standalone::
42 - Limit checks to the contents of GIT_OBJECT_DIRECTORY
43 - ($GIT_DIR/objects), making sure that it is consistent and
44 - complete without referring to objects found in alternate
45 - object pools listed in GIT_ALTERNATE_OBJECT_DIRECTORIES,
46 - nor packed git archives found in $GIT_DIR/objects/pack;
47 - cannot be used with --full.
48 -
41 --full::
42 Check not just objects in GIT_OBJECT_DIRECTORY
43 ($GIT_DIR/objects), but also the ones found in alternate
52 - object pools listed in GIT_ALTERNATE_OBJECT_DIRECTORIES,
44 + object pools listed in GIT_ALTERNATE_OBJECT_DIRECTORIES
45 + or $GIT_DIR/objects/info/alternates,
46 and in packed git archives found in $GIT_DIR/objects/pack
47 and corresponding pack subdirectories in alternate
55 - object pools; cannot be used with --standalone.
48 + object pools.
49
50 --strict::
51 Enable more strict checking, namely to catch a file mode
fsck-objects.c
+5 -15
@@ -14,10 +14,9 @@
14 static int show_root = 0;
15 static int show_tags = 0;
16 static int show_unreachable = 0;
17 -static int standalone = 0;
17 static int check_full = 0;
18 static int check_strict = 0;
20 -static int keep_cache_objects = 0;
19 +static int keep_cache_objects = 0;
20 static unsigned char head_sha1[20];
21
22 #ifdef NO_D_INO_IN_DIRENT
@@ -68,7 +67,7 @@ static void check_connectivity(void)
67 continue;
68
69 if (!obj->parsed) {
71 - if (!standalone && has_sha1_file(obj->sha1))
70 + if (has_sha1_file(obj->sha1))
71 ; /* it is in pack */
72 else
73 printf("missing %s %s\n",
@@ -82,7 +81,7 @@ static void check_connectivity(void)
81 for (j = 0; j < refs->count; j++) {
82 struct object *ref = refs->ref[j];
83 if (ref->parsed ||
85 - (!standalone && has_sha1_file(ref->sha1)))
84 + (has_sha1_file(ref->sha1)))
85 continue;
86 printf("broken link from %7s %s\n",
87 obj->type, sha1_to_hex(obj->sha1));
@@ -390,7 +389,7 @@ static int fsck_handle_ref(const char *refname, const unsigned char *sha1)
389
390 obj = lookup_object(sha1);
391 if (!obj) {
393 - if (!standalone && has_sha1_file(sha1)) {
392 + if (has_sha1_file(sha1)) {
393 default_refs++;
394 return 0; /* it is in a pack */
395 }
@@ -464,10 +463,6 @@ int main(int argc, char **argv)
463 keep_cache_objects = 1;
464 continue;
465 }
467 - if (!strcmp(arg, "--standalone")) {
468 - standalone = 1;
469 - continue;
470 - }
466 if (!strcmp(arg, "--full")) {
467 check_full = 1;
468 continue;
@@ -477,14 +472,9 @@ int main(int argc, char **argv)
472 continue;
473 }
474 if (*arg == '-')
480 - usage("git-fsck-objects [--tags] [--root] [[--unreachable] [--cache] [--standalone | --full] [--strict] <head-sha1>*]");
475 + usage("git-fsck-objects [--tags] [--root] [[--unreachable] [--cache] [--full] [--strict] <head-sha1>*]");
476 }
477
483 - if (standalone && check_full)
484 - die("Only one of --standalone or --full can be used.");
485 - if (standalone)
486 - putenv("GIT_ALTERNATE_OBJECT_DIRECTORIES=");
487 -
478 fsck_head_link();
479 fsck_object_dir(get_object_directory());
480 if (check_full) {