mirror of
https://github.com/git/git.git
synced 2024-06-19 05:29:05 +02:00
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>
This commit is contained in:
parent
16679e373f
commit
7cc91a2f71
|
@ -1381,7 +1381,13 @@ remote.<name>.mirror::
|
||||||
|
|
||||||
remote.<name>.skipDefaultUpdate::
|
remote.<name>.skipDefaultUpdate::
|
||||||
If true, this remote will be skipped by default when updating
|
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::
|
remote.<name>.receivepack::
|
||||||
The default program to execute on the remote side when pushing. See
|
The default program to execute on the remote side when pushing. See
|
||||||
|
|
|
@ -649,7 +649,8 @@ static void set_option(const char *name, const char *value)
|
||||||
static int get_one_remote_for_fetch(struct remote *remote, void *priv)
|
static int get_one_remote_for_fetch(struct remote *remote, void *priv)
|
||||||
{
|
{
|
||||||
struct string_list *list = 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
remote.c
3
remote.c
|
@ -396,7 +396,8 @@ static int handle_config(const char *key, const char *value, void *cb)
|
||||||
remote->mirror = git_config_bool(key, value);
|
remote->mirror = git_config_bool(key, value);
|
||||||
else if (!strcmp(subkey, ".skipdefaultupdate"))
|
else if (!strcmp(subkey, ".skipdefaultupdate"))
|
||||||
remote->skip_default_update = git_config_bool(key, value);
|
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")) {
|
else if (!strcmp(subkey, ".url")) {
|
||||||
const char *v;
|
const char *v;
|
||||||
if (git_config_string(&v, key, value))
|
if (git_config_string(&v, key, value))
|
||||||
|
|
|
@ -94,9 +94,6 @@ test_expect_success 'git fetch --multiple (but only one remote)' '
|
||||||
cat > expect << EOF
|
cat > expect << EOF
|
||||||
one/master
|
one/master
|
||||||
one/side
|
one/side
|
||||||
origin/HEAD -> origin/master
|
|
||||||
origin/master
|
|
||||||
origin/side
|
|
||||||
two/another
|
two/another
|
||||||
two/master
|
two/master
|
||||||
two/side
|
two/side
|
||||||
|
@ -105,6 +102,7 @@ EOF
|
||||||
test_expect_success 'git fetch --multiple (two remotes)' '
|
test_expect_success 'git fetch --multiple (two remotes)' '
|
||||||
(git clone one test4 &&
|
(git clone one test4 &&
|
||||||
cd test4 &&
|
cd test4 &&
|
||||||
|
git remote rm origin &&
|
||||||
git remote add one ../one &&
|
git remote add one ../one &&
|
||||||
git remote add two ../two &&
|
git remote add two ../two &&
|
||||||
git fetch --multiple one two &&
|
git fetch --multiple one two &&
|
||||||
|
@ -117,4 +115,40 @@ test_expect_success 'git fetch --multiple (bad remote names)' '
|
||||||
test_must_fail git fetch --multiple four)
|
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
|
test_done
|
||||||
|
|
Loading…
Reference in New Issue