summaryrefslogtreecommitdiff
path: root/builtin/unpack-objects.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-05-04 23:40:08 (GMT)
committerJeff King <peff@peff.net>2018-05-22 03:55:12 (GMT)
commit6e328d6caef218db320978e3e251009135d87d0e (patch)
treee1d1fe6c3697352fb13c279cc7decf32581548cf /builtin/unpack-objects.c
parent1995b5e03e1cc97116be58cdc0502d4a23547856 (diff)
downloadgit-6e328d6caef218db320978e3e251009135d87d0e.zip
git-6e328d6caef218db320978e3e251009135d87d0e.tar.gz
git-6e328d6caef218db320978e3e251009135d87d0e.tar.bz2
unpack-objects: call fsck_finish() after fscking objects
As with the previous commit, we must call fsck's "finish" function in order to catch any queued objects for .gitmodules checks. This second pass will be able to access any incoming objects, because we will have exploded them to loose objects by now. This isn't quite ideal, because it means that bad objects may have been written to the object database (and a subsequent operation could then reference them, even if the other side doesn't send the objects again). However, this is sufficient when used with receive.fsckObjects, since those loose objects will all be placed in a temporary quarantine area that will get wiped if we find any problems. Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'builtin/unpack-objects.c')
-rw-r--r--builtin/unpack-objects.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c
index 648b952..c8f1406 100644
--- a/builtin/unpack-objects.c
+++ b/builtin/unpack-objects.c
@@ -572,8 +572,11 @@ int cmd_unpack_objects(int argc, const char **argv, const char *prefix)
unpack_all();
the_hash_algo->update_fn(&ctx, buffer, offset);
the_hash_algo->final_fn(oid.hash, &ctx);
- if (strict)
+ if (strict) {
write_rest();
+ if (fsck_finish(&fsck_options))
+ die(_("fsck error in pack objects"));
+ }
if (hashcmp(fill(the_hash_algo->rawsz), oid.hash))
die("final sha1 did not match");
use(the_hash_algo->rawsz);