Skip to content

Commit 5e838ea

Browse files
committed
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 <[email protected]>
1 parent 81b50f3 commit 5e838ea

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Documentation/config.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,12 @@ diff.wordRegex::
820820
sequences that match the regular expression are "words", all other
821821
characters are *ignorable* whitespace.
822822

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+
823829
fetch.unpackLimit::
824830
If the number of objects fetched over the git native
825831
transfer is below this

builtin/fetch-pack.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ static int transfer_unpack_limit = -1;
1414
static int fetch_unpack_limit = -1;
1515
static int unpack_limit = 100;
1616
static int prefer_ofs_delta = 1;
17+
static int fetch_fsck_objects;
1718
static struct fetch_pack_args args = {
1819
/* .uploadpack = */ "git-upload-pack",
1920
};
@@ -663,6 +664,8 @@ static int get_pack(int xd[2], char **pack_lockfile)
663664
}
664665
if (*hdr_arg)
665666
*av++ = hdr_arg;
667+
if (fetch_fsck_objects)
668+
*av++ = "--strict";
666669
*av++ = NULL;
667670

668671
cmd.in = demux.out;
@@ -776,6 +779,11 @@ static int fetch_pack_config(const char *var, const char *value, void *cb)
776779
return 0;
777780
}
778781

782+
if (!strcmp(var, "fetch.fsckobjects")) {
783+
fetch_fsck_objects = git_config_bool(var, value);
784+
return 0;
785+
}
786+
779787
return git_default_config(var, value, cb);
780788
}
781789

0 commit comments

Comments
 (0)