@matheusbsbs / matheus-bagliano / commits / 7cc91a2f71
Fork 0

Add the configuration option skipFetchAll

Implement the configuration skipFetchAll option to allow certain remotes to be skipped when doing 'git fetch --all' and 'git remote update'. The existing skipDefaultUpdate variable is still honored (by 'git fetch --all' and 'git remote update'). (If both are set in the configuration file with different values, the value of the last occurrence will be used.) Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Björn Gustavsson committed Nov 9, 2009 at 21:11 UTC 7cc91a2f71c95b4e695549b91c4b629f56887a1a
4 files changed +48 -6
Documentation/config.txt
+7 -1
@@ -1381,7 +1381,13 @@ remote.<name>.mirror::
1381
1382 remote.<name>.skipDefaultUpdate::
1383 If true, this remote will be skipped by default when updating
1384 - using the update subcommand of linkgit:git-remote[1].
1384 + using linkgit:git-fetch[1] or the `update` subcommand of
1385 + linkgit:git-remote[1].
1386 +
1387 +remote.<name>.skipFetchAll::
1388 + If true, this remote will be skipped by default when updating
1389 + using linkgit:git-fetch[1] or the `update` subcommand of
1390 + linkgit:git-remote[1].
1391
1392 remote.<name>.receivepack::
1393 The default program to execute on the remote side when pushing. See
builtin-fetch.c
+2 -1
@@ -649,7 +649,8 @@ static void set_option(const char *name, const char *value)
649 static int get_one_remote_for_fetch(struct remote *remote, void *priv)
650 {
651 struct string_list *list = priv;
652 - string_list_append(remote->name, list);
652 + if (!remote->skip_default_update)
653 + string_list_append(remote->name, list);
654 return 0;
655 }
656
remote.c
+2 -1
@@ -396,7 +396,8 @@ static int handle_config(const char *key, const char *value, void *cb)
396 remote->mirror = git_config_bool(key, value);
397 else if (!strcmp(subkey, ".skipdefaultupdate"))
398 remote->skip_default_update = git_config_bool(key, value);
399 -
399 + else if (!strcmp(subkey, ".skipfetchall"))
400 + remote->skip_default_update = git_config_bool(key, value);
401 else if (!strcmp(subkey, ".url")) {
402 const char *v;
403 if (git_config_string(&v, key, value))
t/t5514-fetch-multiple.sh
+37 -3
@@ -94,9 +94,6 @@ test_expect_success 'git fetch --multiple (but only one remote)' '
94 cat > expect << EOF
95 one/master
96 one/side
97 - origin/HEAD -> origin/master
98 - origin/master
99 - origin/side
97 two/another
98 two/master
99 two/side
@@ -105,6 +102,7 @@ EOF
102 test_expect_success 'git fetch --multiple (two remotes)' '
103 (git clone one test4 &&
104 cd test4 &&
105 + git remote rm origin &&
106 git remote add one ../one &&
107 git remote add two ../two &&
108 git fetch --multiple one two &&
@@ -117,4 +115,40 @@ test_expect_success 'git fetch --multiple (bad remote names)' '
115 test_must_fail git fetch --multiple four)
116 '
117
118 +
119 +test_expect_success 'git fetch --all (skipFetchAll)' '
120 + (cd test4 &&
121 + for b in $(git branch -r)
122 + do
123 + git branch -r -d $b || break
124 + done &&
125 + git remote add three ../three &&
126 + git config remote.three.skipFetchAll true &&
127 + git fetch --all &&
128 + git branch -r > output &&
129 + test_cmp ../expect output)
130 +'
131 +
132 +cat > expect << EOF
133 + one/master
134 + one/side
135 + three/another
136 + three/master
137 + three/side
138 + two/another
139 + two/master
140 + two/side
141 +EOF
142 +
143 +test_expect_success 'git fetch --multiple (ignoring skipFetchAll)' '
144 + (cd test4 &&
145 + for b in $(git branch -r)
146 + do
147 + git branch -r -d $b || break
148 + done &&
149 + git fetch --multiple one two three &&
150 + git branch -r > output &&
151 + test_cmp ../expect output)
152 +'
153 +
154 test_done