-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Teach the --all option to 'git fetch'
'git remote' is meant for managing remotes and 'git fetch' is meant for actually fetching data from remote repositories. Therefore, it is not logical that you must use 'git remote update' to fetch from more than one repository at once. Add the --all option to 'git fetch', to tell it to attempt to fetch from all remotes. Also, if --all is not given, the <repository> argument is allowed to be the name of a group, to allow fetching from all repositories in the group. Other options except -v and -q are silently ignored. Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Loading branch information
Björn Gustavsson
authored and
Junio C Hamano
committed
Nov 10, 2009
1 parent
6b276e1
commit 9c4a036
Showing
6 changed files
with
247 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
--all:: | ||
Fetch all remotes. | ||
|
||
-a:: | ||
--append:: | ||
Append ref names and object names of fetched refs to the | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/bin/sh | ||
|
||
test_description='fetch --all works correctly' | ||
|
||
. ./test-lib.sh | ||
|
||
setup_repository () { | ||
mkdir "$1" && ( | ||
cd "$1" && | ||
git init && | ||
>file && | ||
git add file && | ||
test_tick && | ||
git commit -m "Initial" && | ||
git checkout -b side && | ||
>elif && | ||
git add elif && | ||
test_tick && | ||
git commit -m "Second" && | ||
git checkout master | ||
) | ||
} | ||
|
||
test_expect_success setup ' | ||
setup_repository one && | ||
setup_repository two && | ||
( | ||
cd two && git branch another | ||
) && | ||
git clone --mirror two three | ||
git clone one test | ||
' | ||
|
||
cat > test/expect << EOF | ||
one/master | ||
one/side | ||
origin/HEAD -> origin/master | ||
origin/master | ||
origin/side | ||
three/another | ||
three/master | ||
three/side | ||
two/another | ||
two/master | ||
two/side | ||
EOF | ||
|
||
test_expect_success 'git fetch --all' ' | ||
(cd test && | ||
git remote add one ../one && | ||
git remote add two ../two && | ||
git remote add three ../three && | ||
git fetch --all && | ||
git branch -r > output && | ||
test_cmp expect output) | ||
' | ||
|
||
test_expect_success 'git fetch --all should continue if a remote has errors' ' | ||
(git clone one test2 && | ||
cd test2 && | ||
git remote add bad ../non-existing && | ||
git remote add one ../one && | ||
git remote add two ../two && | ||
git remote add three ../three && | ||
test_must_fail git fetch --all && | ||
git branch -r > output && | ||
test_cmp ../test/expect output) | ||
' | ||
|
||
test_expect_success 'git fetch --all does not allow non-option arguments' ' | ||
(cd test && | ||
test_must_fail git fetch --all origin && | ||
test_must_fail git fetch --all origin master) | ||
' | ||
|
||
test_done |