fetch.fsckobjects: verify downloaded objects

This corresponds to receive.fsckobjects configuration variable added (a lot) earlier in 20dc001 (receive-pack: allow using --strict mode for unpacking objects, 2008-02-25). Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Sep 4, 2011 at 12:26 UTC 5e838ea7aa74dfbc9820bcf798c0f118e91532f9
2 files changed +14
Documentation/config.txt
+6
@@ -820,6 +820,12 @@ diff.wordRegex::
820 sequences that match the regular expression are "words", all other
821 characters are *ignorable* whitespace.
822
823 +fetch.fsckObjects::
824 + If it is set to true, git-fetch-pack will check all fetched
825 + objects. It will abort in the case of a malformed object or a
826 + broken link. The result of an abort are only dangling objects.
827 + Defaults to false.
828 +
829 fetch.unpackLimit::
830 If the number of objects fetched over the git native
831 transfer is below this
builtin/fetch-pack.c
+8
@@ -14,6 +14,7 @@ static int transfer_unpack_limit = -1;
14 static int fetch_unpack_limit = -1;
15 static int unpack_limit = 100;
16 static int prefer_ofs_delta = 1;
17 +static int fetch_fsck_objects;
18 static struct fetch_pack_args args = {
19 /* .uploadpack = */ "git-upload-pack",
20 };
@@ -663,6 +664,8 @@ static int get_pack(int xd[2], char **pack_lockfile)
664 }
665 if (*hdr_arg)
666 *av++ = hdr_arg;
667 + if (fetch_fsck_objects)
668 + *av++ = "--strict";
669 *av++ = NULL;
670
671 cmd.in = demux.out;
@@ -776,6 +779,11 @@ static int fetch_pack_config(const char *var, const char *value, void *cb)
779 return 0;
780 }
781
782 + if (!strcmp(var, "fetch.fsckobjects")) {
783 + fetch_fsck_objects = git_config_bool(var, value);
784 + return 0;
785 + }
786 +
787 return git_default_config(var, value, cb);
788 }
789