X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft5505-remote.sh;h=af2d077792c108a9125c73d1e4194f2532cb5156;hb=6a42cfe86c485675987b64690e75d8821567d328;hp=004a8dc5ed28f57de76935c4f02803fe6496d4d6;hpb=740fdd27f0888d5c80ef6a550734bdc53febd2df;p=git.git diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh index 004a8dc5e..c4496635d 100755 --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@ -77,6 +77,16 @@ test_expect_success 'add another remote' ' ) ' +test_expect_success 'remote forces tracking branches' ' +( + cd test && + case `git config remote.second.fetch` in + +*) true ;; + *) false ;; + esac +) +' + test_expect_success 'remove remote' ' ( cd test && @@ -99,13 +109,15 @@ test_expect_success 'remove remote' ' cat > test/expect << EOF * remote origin - URL: $(pwd)/one/.git + URL: $(pwd)/one Remote branch merged with 'git pull' while on branch master master New remote branch (next fetch will store in remotes/origin) master Tracked remote branches side master + Local branches pushed with 'git push' + master:upstream +refs/tags/lastbackup EOF test_expect_success 'show' ' @@ -118,8 +130,31 @@ test_expect_success 'show' ' echo 1 > file && test_tick && git commit -m update file) && + git config remote.origin.push \ + refs/heads/master:refs/heads/upstream && + git config --add remote.origin.push \ + +refs/tags/lastbackup && git remote show origin > output && - git diff expect output) + test_cmp expect output) +' + +cat > test/expect << EOF +* remote origin + URL: $(pwd)/one + Remote branch merged with 'git pull' while on branch master + master + Tracked remote branches + master side + Local branches pushed with 'git push' + master:upstream +refs/tags/lastbackup +EOF + +test_expect_success 'show -n' ' + (mv one one.unreachable && + cd test && + git remote show -n origin > output && + mv ../one.unreachable ../one && + test_cmp expect output) ' test_expect_success 'prune' ' @@ -129,7 +164,25 @@ test_expect_success 'prune' ' git fetch origin && git remote prune origin && git rev-parse refs/remotes/origin/side2 && - ! git rev-parse refs/remotes/origin/side) + test_must_fail git rev-parse refs/remotes/origin/side) +' + +cat > test/expect << EOF +Pruning origin +URL: $(pwd)/one + * [would prune] origin/side2 +EOF + +test_expect_success 'prune --dry-run' ' + (cd one && + git branch -m side2 side) && + (cd test && + git remote prune --dry-run origin > output && + git rev-parse refs/remotes/origin/side2 && + test_must_fail git rev-parse refs/remotes/origin/side && + (cd ../one && + git branch -m side side2) && + test_cmp expect output) ' test_expect_success 'add --mirror && prune' ' @@ -141,13 +194,31 @@ test_expect_success 'add --mirror && prune' ' git branch -m side2 side) && (cd mirror && git rev-parse --verify refs/heads/side2 && - ! git rev-parse --verify refs/heads/side && + test_must_fail git rev-parse --verify refs/heads/side && git fetch origin && git remote prune origin && - ! git rev-parse --verify refs/heads/side2 && + test_must_fail git rev-parse --verify refs/heads/side2 && git rev-parse --verify refs/heads/side) ' +test_expect_success 'add alt && prune' ' + (mkdir alttst && + cd alttst && + git init && + git remote add -f origin ../one && + git config remote.alt.url ../one && + git config remote.alt.fetch "+refs/heads/*:refs/remotes/origin/*") && + (cd one && + git branch -m side side2) && + (cd alttst && + git rev-parse --verify refs/remotes/origin/side && + test_must_fail git rev-parse --verify refs/remotes/origin/side2 && + git fetch alt && + git remote prune alt && + test_must_fail git rev-parse --verify refs/remotes/origin/side && + git rev-parse --verify refs/remotes/origin/side2) +' + cat > one/expect << EOF apis/master apis/side @@ -163,7 +234,7 @@ test_expect_success 'update' ' git remote add apis ../mirror && git remote update && git branch -r > output && - git diff expect output) + test_cmp expect output) ' @@ -190,7 +261,7 @@ test_expect_success 'update with arguments' ' git config remotes.titanus manduca && git remote update phobaeticus titanus && git branch -r > output && - git diff expect output) + test_cmp expect output) ' @@ -213,7 +284,7 @@ test_expect_success 'update default' ' git config remote.drosophila.skipDefaultUpdate true && git remote update default && git branch -r > output && - git diff expect output) + test_cmp expect output) ' @@ -233,7 +304,7 @@ test_expect_success 'update default (overridden, with funny whitespace)' ' git config remotes.default "$(printf "\t drosophila \n")" && git remote update default && git branch -r > output && - git diff expect output) + test_cmp expect output) ' @@ -247,4 +318,10 @@ test_expect_success '"remote show" does not show symbolic refs' ' ' +test_expect_success 'reject adding remote with an invalid name' ' + + test_must_fail git remote add some:url desired-name + +' + test_done