transfer.fsckobjects: unify fetch/receive.fsckobjects

This single variable can be used to set instead of setting fsckobjects
variable for fetch & receive independently.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano 2011-09-04 12:37:45 -07:00
parent 5e838ea7aa
commit dab76d3aa6
3 changed files with 35 additions and 7 deletions

View File

@ -824,7 +824,8 @@ fetch.fsckObjects::
If it is set to true, git-fetch-pack will check all fetched If it is set to true, git-fetch-pack will check all fetched
objects. It will abort in the case of a malformed object or a objects. It will abort in the case of a malformed object or a
broken link. The result of an abort are only dangling objects. broken link. The result of an abort are only dangling objects.
Defaults to false. Defaults to false. If not set, the value of `transfer.fsckObjects`
is used instead.
fetch.unpackLimit:: fetch.unpackLimit::
If the number of objects fetched over the git native If the number of objects fetched over the git native
@ -1427,7 +1428,8 @@ receive.fsckObjects::
If it is set to true, git-receive-pack will check all received If it is set to true, git-receive-pack will check all received
objects. It will abort in the case of a malformed object or a objects. It will abort in the case of a malformed object or a
broken link. The result of an abort are only dangling objects. broken link. The result of an abort are only dangling objects.
Defaults to false. Defaults to false. If not set, the value of `transfer.fsckObjects`
is used instead.
receive.unpackLimit:: receive.unpackLimit::
If the number of objects received in a push is below this If the number of objects received in a push is below this
@ -1616,6 +1618,11 @@ tar.umask::
archiving user's umask will be used instead. See umask(2) and archiving user's umask will be used instead. See umask(2) and
linkgit:git-archive[1]. linkgit:git-archive[1].
transfer.fsckObjects::
When `fetch.fsckObjects` or `receive.fsckObjects` are
not set, the value of this variable is used instead.
Defaults to false.
transfer.unpackLimit:: transfer.unpackLimit::
When `fetch.unpackLimit` or `receive.unpackLimit` are When `fetch.unpackLimit` or `receive.unpackLimit` are
not set, the value of this variable is used instead. not set, the value of this variable is used instead.

View File

@ -14,7 +14,8 @@ static int transfer_unpack_limit = -1;
static int fetch_unpack_limit = -1; static int fetch_unpack_limit = -1;
static int unpack_limit = 100; static int unpack_limit = 100;
static int prefer_ofs_delta = 1; static int prefer_ofs_delta = 1;
static int fetch_fsck_objects; static int fetch_fsck_objects = -1;
static int transfer_fsck_objects = -1;
static struct fetch_pack_args args = { static struct fetch_pack_args args = {
/* .uploadpack = */ "git-upload-pack", /* .uploadpack = */ "git-upload-pack",
}; };
@ -664,7 +665,11 @@ static int get_pack(int xd[2], char **pack_lockfile)
} }
if (*hdr_arg) if (*hdr_arg)
*av++ = hdr_arg; *av++ = hdr_arg;
if (fetch_fsck_objects) if (fetch_fsck_objects >= 0
? fetch_fsck_objects
: transfer_fsck_objects >= 0
? transfer_fsck_objects
: 0)
*av++ = "--strict"; *av++ = "--strict";
*av++ = NULL; *av++ = NULL;
@ -784,6 +789,11 @@ static int fetch_pack_config(const char *var, const char *value, void *cb)
return 0; return 0;
} }
if (!strcmp(var, "transfer.fsckobjects")) {
transfer_fsck_objects = git_config_bool(var, value);
return 0;
}
return git_default_config(var, value, cb); return git_default_config(var, value, cb);
} }

View File

@ -23,7 +23,8 @@ static int deny_deletes;
static int deny_non_fast_forwards; static int deny_non_fast_forwards;
static enum deny_action deny_current_branch = DENY_UNCONFIGURED; static enum deny_action deny_current_branch = DENY_UNCONFIGURED;
static enum deny_action deny_delete_current = DENY_UNCONFIGURED; static enum deny_action deny_delete_current = DENY_UNCONFIGURED;
static int receive_fsck_objects; static int receive_fsck_objects = -1;
static int transfer_fsck_objects = -1;
static int receive_unpack_limit = -1; static int receive_unpack_limit = -1;
static int transfer_unpack_limit = -1; static int transfer_unpack_limit = -1;
static int unpack_limit = 100; static int unpack_limit = 100;
@ -77,6 +78,11 @@ static int receive_pack_config(const char *var, const char *value, void *cb)
return 0; return 0;
} }
if (strcmp(var, "transfer.fsckobjects") == 0) {
transfer_fsck_objects = git_config_bool(var, value);
return 0;
}
if (!strcmp(var, "receive.denycurrentbranch")) { if (!strcmp(var, "receive.denycurrentbranch")) {
deny_current_branch = parse_deny_action(var, value); deny_current_branch = parse_deny_action(var, value);
return 0; return 0;
@ -586,6 +592,11 @@ static const char *unpack(void)
struct pack_header hdr; struct pack_header hdr;
const char *hdr_err; const char *hdr_err;
char hdr_arg[38]; char hdr_arg[38];
int fsck_objects = (receive_fsck_objects >= 0
? receive_fsck_objects
: transfer_fsck_objects >= 0
? transfer_fsck_objects
: 0);
hdr_err = parse_pack_header(&hdr); hdr_err = parse_pack_header(&hdr);
if (hdr_err) if (hdr_err)
@ -598,7 +609,7 @@ static const char *unpack(void)
int code, i = 0; int code, i = 0;
const char *unpacker[4]; const char *unpacker[4];
unpacker[i++] = "unpack-objects"; unpacker[i++] = "unpack-objects";
if (receive_fsck_objects) if (fsck_objects)
unpacker[i++] = "--strict"; unpacker[i++] = "--strict";
unpacker[i++] = hdr_arg; unpacker[i++] = hdr_arg;
unpacker[i++] = NULL; unpacker[i++] = NULL;
@ -618,7 +629,7 @@ static const char *unpack(void)
keeper[i++] = "index-pack"; keeper[i++] = "index-pack";
keeper[i++] = "--stdin"; keeper[i++] = "--stdin";
if (receive_fsck_objects) if (fsck_objects)
keeper[i++] = "--strict"; keeper[i++] = "--strict";
keeper[i++] = "--fix-thin"; keeper[i++] = "--fix-thin";
keeper[i++] = hdr_arg; keeper[i++] = hdr_arg;