summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 16679e3)
raw | patch | inline | side by side (parent: 16679e3)
author | Björn Gustavsson <bgustavsson@gmail.com> | |
Mon, 9 Nov 2009 20:11:06 +0000 (21:11 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 10 Nov 2009 09:01:07 +0000 (01:01 -0800) |
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>
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>
Documentation/config.txt | patch | blob | history | |
builtin-fetch.c | patch | blob | history | |
remote.c | patch | blob | history | |
t/t5514-fetch-multiple.sh | patch | blob | history |
index cd1781498eb92d7dd0d3648a8fe188fc75a6df8c..50a65ab8d1b375d2987732dfa636447c59daa16d 100644 (file)
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
remote.<name>.skipDefaultUpdate::
If true, this remote will be skipped by default when updating
- using the update subcommand of linkgit:git-remote[1].
+ using linkgit:git-fetch[1] or the `update` subcommand of
+ linkgit:git-remote[1].
+
+remote.<name>.skipFetchAll::
+ If true, this remote will be skipped by default when updating
+ using linkgit:git-fetch[1] or the `update` subcommand of
+ linkgit:git-remote[1].
remote.<name>.receivepack::
The default program to execute on the remote side when pushing. See
diff --git a/builtin-fetch.c b/builtin-fetch.c
index c903c66d47c52d7e585866ab3182ec1eb69408b0..4cbd69075f718ce97abefddbf99c1f0ccbf67774 100644 (file)
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
static int get_one_remote_for_fetch(struct remote *remote, void *priv)
{
struct string_list *list = priv;
- string_list_append(remote->name, list);
+ if (!remote->skip_default_update)
+ string_list_append(remote->name, list);
return 0;
}
diff --git a/remote.c b/remote.c
index 73d33f2584b061085fcaa0958c26b1c3d4665904..beaf9fb5b2ac37db11f11175ec89a0df5fba425b 100644 (file)
--- a/remote.c
+++ b/remote.c
remote->mirror = git_config_bool(key, value);
else if (!strcmp(subkey, ".skipdefaultupdate"))
remote->skip_default_update = git_config_bool(key, value);
-
+ else if (!strcmp(subkey, ".skipfetchall"))
+ remote->skip_default_update = git_config_bool(key, value);
else if (!strcmp(subkey, ".url")) {
const char *v;
if (git_config_string(&v, key, value))
index 69c64ab1e4029ce00c4b965cbb30227e269058f1..b73733219d62cabf02c59ed0bf08caec1158faef 100755 (executable)
cat > expect << EOF
one/master
one/side
- origin/HEAD -> origin/master
- origin/master
- origin/side
two/another
two/master
two/side
test_expect_success 'git fetch --multiple (two remotes)' '
(git clone one test4 &&
cd test4 &&
+ git remote rm origin &&
git remote add one ../one &&
git remote add two ../two &&
git fetch --multiple one two &&
test_must_fail git fetch --multiple four)
'
+
+test_expect_success 'git fetch --all (skipFetchAll)' '
+ (cd test4 &&
+ for b in $(git branch -r)
+ do
+ git branch -r -d $b || break
+ done &&
+ git remote add three ../three &&
+ git config remote.three.skipFetchAll true &&
+ git fetch --all &&
+ git branch -r > output &&
+ test_cmp ../expect output)
+'
+
+cat > expect << EOF
+ one/master
+ one/side
+ three/another
+ three/master
+ three/side
+ two/another
+ two/master
+ two/side
+EOF
+
+test_expect_success 'git fetch --multiple (ignoring skipFetchAll)' '
+ (cd test4 &&
+ for b in $(git branch -r)
+ do
+ git branch -r -d $b || break
+ done &&
+ git fetch --multiple one two three &&
+ git branch -r > output &&
+ test_cmp ../expect output)
+'
+
test_done