diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-10-26 16:16:29 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-10-26 16:16:29 -0700 |
commit | 9c0c09f791b1bfd2a04aa0e48190d304627293d2 (patch) | |
tree | ad77947d4cfb61a39048f3d9791282ddee377e5f /t | |
parent | f384a2edd62dfc4af0f051dc8248506cebb265f9 (diff) | |
parent | e8c1e6c796c1b96b6b208bbd4bc8cfd9acb481b5 (diff) | |
download | git-9c0c09f791b1bfd2a04aa0e48190d304627293d2.tar.gz git-9c0c09f791b1bfd2a04aa0e48190d304627293d2.tar.xz |
Merge branch 'cn/fetch-prune'
* cn/fetch-prune:
fetch: treat --tags like refs/tags/*:refs/tags/* when pruning
fetch: honor the user-provided refspecs when pruning refs
remote: separate out the remote_find_tracking logic into query_refspecs
t5510: add tests for fetch --prune
fetch: free all the additional refspecs
Conflicts:
remote.c
Diffstat (limited to 't')
-rwxr-xr-x | t/t5510-fetch.sh | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 7e433b179..e0af4c4e6 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -76,6 +76,56 @@ test_expect_success "fetch test for-merge" ' cut -f -2 .git/FETCH_HEAD >actual && test_cmp expected actual' +test_expect_success 'fetch --prune on its own works as expected' ' + cd "$D" && + git clone . prune && + cd prune && + git fetch origin refs/heads/master:refs/remotes/origin/extrabranch && + + git fetch --prune origin && + test_must_fail git rev-parse origin/extrabranch +' + +test_expect_success 'fetch --prune with a branch name keeps branches' ' + cd "$D" && + git clone . prune-branch && + cd prune-branch && + git fetch origin refs/heads/master:refs/remotes/origin/extrabranch && + + git fetch --prune origin master && + git rev-parse origin/extrabranch +' + +test_expect_success 'fetch --prune with a namespace keeps other namespaces' ' + cd "$D" && + git clone . prune-namespace && + cd prune-namespace && + + git fetch --prune origin refs/heads/a/*:refs/remotes/origin/a/* && + git rev-parse origin/master +' + +test_expect_success 'fetch --prune --tags does not delete the remote-tracking branches' ' + cd "$D" && + git clone . prune-tags && + cd prune-tags && + git fetch origin refs/heads/master:refs/tags/sometag && + + git fetch --prune --tags origin && + git rev-parse origin/master && + test_must_fail git rev-parse somebranch +' + +test_expect_success 'fetch --prune --tags with branch does not delete other remote-tracking branches' ' + cd "$D" && + git clone . prune-tags-branch && + cd prune-tags-branch && + git fetch origin refs/heads/master:refs/remotes/origin/extrabranch && + + git fetch --prune --tags origin master && + git rev-parse origin/extrabranch +' + test_expect_success 'fetch tags when there is no tags' ' cd "$D" && |