summaryrefslogtreecommitdiff
path: root/t/t5505-remote.sh
diff options
context:
space:
mode:
authorLibravatar Johannes Schindelin <Johannes.Schindelin@gmx.de>2008-03-04 11:23:53 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2008-03-05 12:17:39 -0800
commit84521ed6f2ccfd8dfe001806f83bb28e6a8934be (patch)
tree38bd649a66c8a3aa6cc9ccf8b0189d4cd0273e08 /t/t5505-remote.sh
parentremote show: Clean up connection correctly if object fetch wasn't done (diff)
downloadtgif-84521ed6f2ccfd8dfe001806f83bb28e6a8934be.tar.xz
remote: fix "update [group...]"
The rewrite in C inadvertently broke updating with remote groups: when you pass parameters to "git remote update", it used to look up "remotes.<group>" for every parameter, and interpret the value as a list of remotes to update. Also, no parameter, or a single parameter "default" should update all remotes that have not been marked with "skipDefaultUpdate". Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5505-remote.sh')
-rwxr-xr-xt/t5505-remote.sh92
1 files changed, 92 insertions, 0 deletions
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 0a25c8b71c..f45ea68f63 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -10,10 +10,12 @@ setup_repository () {
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
)
@@ -113,6 +115,7 @@ test_expect_success 'show' '
git branch -d -r origin/master &&
(cd ../one &&
echo 1 > file &&
+ test_tick &&
git commit -m update file) &&
git remote show origin > output &&
git diff expect output)
@@ -144,4 +147,93 @@ test_expect_success 'add --mirror && prune' '
git rev-parse --verify refs/heads/side)
'
+cat > one/expect << EOF
+ apis/master
+ apis/side
+ drosophila/another
+ drosophila/master
+ drosophila/side
+EOF
+
+test_expect_success 'update' '
+
+ (cd one &&
+ git remote add drosophila ../two &&
+ git remote add apis ../mirror &&
+ git remote update &&
+ git branch -r > output &&
+ git diff expect output)
+
+'
+
+cat > one/expect << EOF
+ drosophila/another
+ drosophila/master
+ drosophila/side
+ manduca/master
+ manduca/side
+ megaloprepus/master
+ megaloprepus/side
+EOF
+
+test_expect_success 'update with arguments' '
+
+ (cd one &&
+ for b in $(git branch -r)
+ do
+ git branch -r -d $b || break
+ done &&
+ git remote add manduca ../mirror &&
+ git remote add megaloprepus ../mirror &&
+ git config remotes.phobaeticus "drosophila megaloprepus" &&
+ git config remotes.titanus manduca &&
+ git remote update phobaeticus titanus &&
+ git branch -r > output &&
+ git diff expect output)
+
+'
+
+cat > one/expect << EOF
+ apis/master
+ apis/side
+ manduca/master
+ manduca/side
+ megaloprepus/master
+ megaloprepus/side
+EOF
+
+test_expect_success 'update default' '
+
+ (cd one &&
+ for b in $(git branch -r)
+ do
+ git branch -r -d $b || break
+ done &&
+ git config remote.drosophila.skipDefaultUpdate true &&
+ git remote update default &&
+ git branch -r > output &&
+ git diff expect output)
+
+'
+
+cat > one/expect << EOF
+ drosophila/another
+ drosophila/master
+ drosophila/side
+EOF
+
+test_expect_success 'update default (overridden, with funny whitespace)' '
+
+ (cd one &&
+ for b in $(git branch -r)
+ do
+ git branch -r -d $b || break
+ done &&
+ git config remotes.default "$(printf "\t drosophila \n")" &&
+ git remote update default &&
+ git branch -r > output &&
+ git diff expect output)
+
+'
+
test_done