summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 469e2eb)
raw | patch | inline | side by side (parent: 469e2eb)
author | Junio C Hamano <gitster@pobox.com> | |
Fri, 30 Jan 2009 08:50:54 +0000 (00:50 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 31 Jan 2009 03:23:22 +0000 (19:23 -0800) |
"git fsck" used to validate only loose objects that are local and nothing
else by default. This is not just too little when a repository is
borrowing objects from other object stores, but also caused the
connectivity check to mistakenly declare loose objects borrowed from them
to be missing.
The rationale behind the default mode that validates only loose objects is
because these objects are still young and more unlikely to have been
pushed to other repositories yet. That holds for loose objects borrowed
from alternate object stores as well.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
else by default. This is not just too little when a repository is
borrowing objects from other object stores, but also caused the
connectivity check to mistakenly declare loose objects borrowed from them
to be missing.
The rationale behind the default mode that validates only loose objects is
because these objects are still young and more unlikely to have been
pushed to other repositories yet. That holds for loose objects borrowed
from alternate object stores as well.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-fsck.c | patch | blob | history | |
t/t1450-fsck.sh | patch | blob | history |
diff --git a/builtin-fsck.c b/builtin-fsck.c
index 2cfff43f3392d9207362506524a1a28fa0c44b1f..64dffa542170fcceedc766ae6551134f61779893 100644 (file)
--- a/builtin-fsck.c
+++ b/builtin-fsck.c
int cmd_fsck(int argc, const char **argv, const char *prefix)
{
int i, heads;
+ struct alternate_object_database *alt;
errors_found = 0;
fsck_head_link();
fsck_object_dir(get_object_directory());
+
+ prepare_alt_odb();
+ for (alt = alt_odb_list; alt; alt = alt->next) {
+ char namebuf[PATH_MAX];
+ int namelen = alt->name - alt->base;
+ memcpy(namebuf, alt->base, namelen);
+ namebuf[namelen - 1] = 0;
+ fsck_object_dir(namebuf);
+ }
+
if (check_full) {
- struct alternate_object_database *alt;
struct packed_git *p;
- prepare_alt_odb();
- for (alt = alt_odb_list; alt; alt = alt->next) {
- char namebuf[PATH_MAX];
- int namelen = alt->name - alt->base;
- memcpy(namebuf, alt->base, namelen);
- namebuf[namelen - 1] = 0;
- fsck_object_dir(namebuf);
- }
+
prepare_packed_git();
for (p = packed_git; p; p = p->next)
/* verify gives error messages itself */
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index d3a17b45081c099547c63d4b9be7a6dd47f07deb..4597af0eb6c5c0508dd40306ce2790fc4f6afb0c 100755 (executable)
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
test 0 = $(git fsck | wc -l)
'
+test_expect_success 'loose objects borrowed from alternate are not missing' '
+ mkdir another &&
+ (
+ cd another &&
+ git init &&
+ echo ../../../.git/objects >.git/objects/info/alternates &&
+ test_commit C fileC one &&
+ git fsck >out &&
+ ! grep "missing blob" out
+ )
+'
+
test_done