diff options
author | Vincent Ambo <mail@tazj.in> | 2020-11-21T18·20+0100 |
---|---|---|
committer | Vincent Ambo <mail@tazj.in> | 2020-11-21T18·45+0100 |
commit | f4609b896fac842433bd495c166d5987852a6a73 (patch) | |
tree | 95511c465c54c4f5d27e5d39ce187e2a1dd82bd3 /third_party/git/t/t5505-remote.sh | |
parent | 082c006c04343a78d87b6c6ab3608c25d6213c3f (diff) |
merge(3p/git): Merge git subtree at v2.29.2 r/1890
This also bumps the stable nixpkgs to 20.09 as of 2020-11-21, because there is some breakage in the git build related to the netrc credentials helper which someone has taken care of in nixpkgs. The stable channel is not used for anything other than git, so this should be fine. Change-Id: I3575a19dab09e1e9556cf8231d717de9890484fb
Diffstat (limited to 'third_party/git/t/t5505-remote.sh')
-rwxr-xr-x | third_party/git/t/t5505-remote.sh | 96 |
1 files changed, 91 insertions, 5 deletions
diff --git a/third_party/git/t/t5505-remote.sh b/third_party/git/t/t5505-remote.sh index 883b32efa024..8d62edd98b5c 100755 --- a/third_party/git/t/t5505-remote.sh +++ b/third_party/git/t/t5505-remote.sh @@ -734,15 +734,53 @@ test_expect_success 'reject adding remote with an invalid name' ' # the last two ones check if the config is updated. test_expect_success 'rename a remote' ' + test_config_global remote.pushDefault origin && git clone one four && ( cd four && + git config branch.master.pushRemote origin && git remote rename origin upstream && test -z "$(git for-each-ref refs/remotes/origin)" && test "$(git symbolic-ref refs/remotes/upstream/HEAD)" = "refs/remotes/upstream/master" && test "$(git rev-parse upstream/master)" = "$(git rev-parse master)" && test "$(git config remote.upstream.fetch)" = "+refs/heads/*:refs/remotes/upstream/*" && - test "$(git config branch.master.remote)" = "upstream" + test "$(git config branch.master.remote)" = "upstream" && + test "$(git config branch.master.pushRemote)" = "upstream" && + test "$(git config --global remote.pushDefault)" = "origin" + ) +' + +test_expect_success 'rename a remote renames repo remote.pushDefault' ' + git clone one four.1 && + ( + cd four.1 && + git config remote.pushDefault origin && + git remote rename origin upstream && + test "$(git config --local remote.pushDefault)" = "upstream" + ) +' + +test_expect_success 'rename a remote renames repo remote.pushDefault but ignores global' ' + test_config_global remote.pushDefault other && + git clone one four.2 && + ( + cd four.2 && + git config remote.pushDefault origin && + git remote rename origin upstream && + test "$(git config --global remote.pushDefault)" = "other" && + test "$(git config --local remote.pushDefault)" = "upstream" + ) +' + +test_expect_success 'rename a remote renames repo remote.pushDefault but keeps global' ' + test_config_global remote.pushDefault origin && + git clone one four.3 && + ( + cd four.3 && + git config remote.pushDefault origin && + git remote rename origin upstream && + test "$(git config --global remote.pushDefault)" = "origin" && + test "$(git config --local remote.pushDefault)" = "upstream" ) ' @@ -784,6 +822,54 @@ test_expect_success 'rename succeeds with existing remote.<target>.prune' ' git -C four.four remote rename origin upstream ' +test_expect_success 'remove a remote' ' + test_config_global remote.pushDefault origin && + git clone one four.five && + ( + cd four.five && + git config branch.master.pushRemote origin && + git remote remove origin && + test -z "$(git for-each-ref refs/remotes/origin)" && + test_must_fail git config branch.master.remote && + test_must_fail git config branch.master.pushRemote && + test "$(git config --global remote.pushDefault)" = "origin" + ) +' + +test_expect_success 'remove a remote removes repo remote.pushDefault' ' + git clone one four.five.1 && + ( + cd four.five.1 && + git config remote.pushDefault origin && + git remote remove origin && + test_must_fail git config --local remote.pushDefault + ) +' + +test_expect_success 'remove a remote removes repo remote.pushDefault but ignores global' ' + test_config_global remote.pushDefault other && + git clone one four.five.2 && + ( + cd four.five.2 && + git config remote.pushDefault origin && + git remote remove origin && + test "$(git config --global remote.pushDefault)" = "other" && + test_must_fail git config --local remote.pushDefault + ) +' + +test_expect_success 'remove a remote removes repo remote.pushDefault but keeps global' ' + test_config_global remote.pushDefault origin && + git clone one four.five.3 && + ( + cd four.five.3 && + git config remote.pushDefault origin && + git remote remove origin && + test "$(git config --global remote.pushDefault)" = "origin" && + test_must_fail git config --local remote.pushDefault + ) +' + cat >remotes_origin <<EOF URL: $(pwd)/one Push: refs/heads/master:refs/heads/upstream @@ -902,7 +988,7 @@ test_expect_success 'remote set-branches' ' +refs/heads/maint:refs/remotes/scratch/maint +refs/heads/master:refs/remotes/scratch/master +refs/heads/next:refs/remotes/scratch/next - +refs/heads/pu:refs/remotes/scratch/pu + +refs/heads/seen:refs/remotes/scratch/seen +refs/heads/t/topic:refs/remotes/scratch/t/topic EOF sort <<-\EOF >expect.setup-ffonly && @@ -912,7 +998,7 @@ test_expect_success 'remote set-branches' ' sort <<-\EOF >expect.respect-ffonly && refs/heads/master:refs/remotes/scratch/master +refs/heads/next:refs/remotes/scratch/next - +refs/heads/pu:refs/remotes/scratch/pu + +refs/heads/seen:refs/remotes/scratch/seen EOF git clone .git/ setbranches && @@ -930,7 +1016,7 @@ test_expect_success 'remote set-branches' ' git config --get-all remote.scratch.fetch >config-result && sort <config-result >../actual.replace && - git remote set-branches --add scratch pu t/topic && + git remote set-branches --add scratch seen t/topic && git config --get-all remote.scratch.fetch >config-result && sort <config-result >../actual.add-two && @@ -942,7 +1028,7 @@ test_expect_success 'remote set-branches' ' git config --get-all remote.scratch.fetch >config-result && sort <config-result >../actual.setup-ffonly && - git remote set-branches --add scratch pu && + git remote set-branches --add scratch seen && git config --get-all remote.scratch.fetch >config-result && sort <config-result >../actual.respect-ffonly ) && |