diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2010-05-19 13:38:50 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-05-19 20:45:41 -0700 |
commit | 3d8b69495fd1132d5af6d7f46425cca97a937d97 (patch) | |
tree | 174092947dfbff9ef6f261a838b1a07e048d07e0 /t/t5505-remote.sh | |
parent | 636e87d705c2d6cc53d58eac31b689779d00b292 (diff) | |
download | git-3d8b69495fd1132d5af6d7f46425cca97a937d97.tar.gz |
Add git remote set-branches
Add ‘git remote set-branches’ for changing the list of tracked refs
for a remote repository with one "porcelain-level" command. This
complements the longstanding ‘git remote add --track’ option.
The interface is based on the ‘git remote set-url’ subcommand.
git remote set-branches base --add C
git remote set-branches base A B D
git remote set-branches base --delete D; # not implemented
Suggested-by: martin f. krafft <madduck@debian.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5505-remote.sh')
-rwxr-xr-x | t/t5505-remote.sh | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh index 230c0cd784..8aaf53ed81 100755 --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@ -534,6 +534,94 @@ test_expect_success 'show empty remote' ' ) ' +test_expect_success 'remote set-branches requires a remote' ' + test_must_fail git remote set-branches && + test_must_fail git remote set-branches --add +' + +test_expect_success 'remote set-branches' ' + echo "+refs/heads/*:refs/remotes/scratch/*" >expect.initial && + sort <<-\EOF >expect.add && + +refs/heads/*:refs/remotes/scratch/* + +refs/heads/other:refs/remotes/scratch/other + EOF + sort <<-\EOF >expect.replace && + +refs/heads/maint:refs/remotes/scratch/maint + +refs/heads/master:refs/remotes/scratch/master + +refs/heads/next:refs/remotes/scratch/next + EOF + sort <<-\EOF >expect.add-two && + +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/t/topic:refs/remotes/scratch/t/topic + EOF + sort <<-\EOF >expect.setup-ffonly && + refs/heads/master:refs/remotes/scratch/master + +refs/heads/next:refs/remotes/scratch/next + EOF + 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 + EOF + + git clone .git/ setbranches && + ( + cd setbranches && + git remote rename origin scratch && + git config --get-all remote.scratch.fetch >config-result && + sort <config-result >../actual.initial && + + git remote set-branches scratch --add other && + git config --get-all remote.scratch.fetch >config-result && + sort <config-result >../actual.add && + + git remote set-branches scratch maint master next && + git config --get-all remote.scratch.fetch >config-result && + sort <config-result >../actual.replace && + + git remote set-branches --add scratch pu t/topic && + git config --get-all remote.scratch.fetch >config-result && + sort <config-result >../actual.add-two && + + git config --unset-all remote.scratch.fetch && + git config remote.scratch.fetch \ + refs/heads/master:refs/remotes/scratch/master && + git config --add remote.scratch.fetch \ + +refs/heads/next:refs/remotes/scratch/next && + git config --get-all remote.scratch.fetch >config-result && + sort <config-result >../actual.setup-ffonly && + + git remote set-branches --add scratch pu && + git config --get-all remote.scratch.fetch >config-result && + sort <config-result >../actual.respect-ffonly + ) && + test_cmp expect.initial actual.initial && + test_cmp expect.add actual.add && + test_cmp expect.replace actual.replace && + test_cmp expect.add-two actual.add-two && + test_cmp expect.setup-ffonly actual.setup-ffonly && + test_cmp expect.respect-ffonly actual.respect-ffonly +' + +test_expect_success 'remote set-branches with --mirror' ' + echo "+refs/*:refs/*" >expect.initial && + echo "+refs/heads/master:refs/heads/master" >expect.replace && + git clone --mirror .git/ setbranches-mirror && + ( + cd setbranches-mirror && + git remote rename origin scratch && + git config --get-all remote.scratch.fetch >../actual.initial && + + git remote set-branches scratch heads/master && + git config --get-all remote.scratch.fetch >../actual.replace + ) && + test_cmp expect.initial actual.initial && + test_cmp expect.replace actual.replace +' + test_expect_success 'new remote' ' git remote add someremote foo && echo foo >expect && |