@matheusbsbs / matheus-bagliano / commits / e28714c527
Fork 0

Consolidate {receive,fetch}.unpackLimit

This allows transfer.unpackLimit to specify what these two configuration variables want to set. We would probably want to deprecate the two separate variables, as I do not see much point in specifying them independently. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Jan 24, 2007 at 17:02 UTC e28714c527339a477fca226765163b9361d94285
4 files changed +35 -10
Documentation/config.txt
+5
@@ -488,3 +488,8 @@ receive.denyNonFastForwards::
488 even if that push is forced. This configuration variable is
489 set when initializing a shared repository.
490
491 +transfer.unpackLimit::
492 + When `fetch.unpackLimit` or `receive.unpackLimit` are
493 + not set, the value of this variable is used instead.
494 +
495 +
fetch-pack.c
+13 -1
@@ -8,6 +8,8 @@
8 #include "sideband.h"
9
10 static int keep_pack;
11 +static int transfer_unpack_limit = -1;
12 +static int fetch_unpack_limit = -1;
13 static int unpack_limit = 100;
14 static int quiet;
15 static int verbose;
@@ -645,7 +647,12 @@ static int remove_duplicates(int nr_heads, char **heads)
647 static int fetch_pack_config(const char *var, const char *value)
648 {
649 if (strcmp(var, "fetch.unpacklimit") == 0) {
648 - unpack_limit = git_config_int(var, value);
650 + fetch_unpack_limit = git_config_int(var, value);
651 + return 0;
652 + }
653 +
654 + if (strcmp(var, "transfer.unpacklimit") == 0) {
655 + transfer_unpack_limit = git_config_int(var, value);
656 return 0;
657 }
658
@@ -666,6 +673,11 @@ int main(int argc, char **argv)
673 setup_ident();
674 git_config(fetch_pack_config);
675
676 + if (0 <= transfer_unpack_limit)
677 + unpack_limit = transfer_unpack_limit;
678 + else if (0 <= fetch_unpack_limit)
679 + unpack_limit = fetch_unpack_limit;
680 +
681 nr_heads = 0;
682 heads = NULL;
683 for (i = 1; i < argc; i++) {
receive-pack.c
+16 -8
@@ -10,6 +10,8 @@
10 static const char receive_pack_usage[] = "git-receive-pack <git-dir>";
11
12 static int deny_non_fast_forwards = 0;
13 +static int receive_unpack_limit = -1;
14 +static int transfer_unpack_limit = -1;
15 static int unpack_limit = 100;
16 static int report_status;
17
@@ -18,21 +20,22 @@ static int capabilities_sent;
20
21 static int receive_pack_config(const char *var, const char *value)
22 {
21 - git_default_config(var, value);
22 -
23 - if (strcmp(var, "receive.denynonfastforwards") == 0)
24 - {
23 + if (strcmp(var, "receive.denynonfastforwards") == 0) {
24 deny_non_fast_forwards = git_config_bool(var, value);
25 return 0;
26 }
27
29 - if (strcmp(var, "receive.unpacklimit") == 0)
30 - {
31 - unpack_limit = git_config_int(var, value);
28 + if (strcmp(var, "receive.unpacklimit") == 0) {
29 + receive_unpack_limit = git_config_int(var, value);
30 return 0;
31 }
32
35 - return 0;
33 + if (strcmp(var, "transfer.unpacklimit") == 0) {
34 + transfer_unpack_limit = git_config_int(var, value);
35 + return 0;
36 + }
37 +
38 + return git_default_config(var, value);
39 }
40
41 static int show_ref(const char *path, const unsigned char *sha1, int flag, void *cb_data)
@@ -431,6 +434,11 @@ int main(int argc, char **argv)
434 ignore_missing_committer_name();
435 git_config(receive_pack_config);
436
437 + if (0 <= transfer_unpack_limit)
438 + unpack_limit = transfer_unpack_limit;
439 + else if (0 <= receive_unpack_limit)
440 + unpack_limit = receive_unpack_limit;
441 +
442 write_head_info();
443
444 /* EOF */
t/t5500-fetch-pack.sh
+1 -1
@@ -98,7 +98,7 @@ pull_to_client () {
98 mkdir client &&
99 cd client &&
100 git-init 2>> log2.txt &&
101 - git repo-config fetch.unpacklimit 0
101 + git repo-config transfer.unpacklimit 0
102 )
103
104 add A1