Skip to content

Commit 43a8a04

Browse files
carlosmngitster
authored andcommitted
t5510: add tests for fetch --prune
The failures will be fixed in later commits. Signed-off-by: Carlos Martín Nieto <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5caf197 commit 43a8a04

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

t/t5510-fetch.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,56 @@ test_expect_success "fetch test for-merge" '
7676
cut -f -2 .git/FETCH_HEAD >actual &&
7777
test_cmp expected actual'
7878

79+
test_expect_success 'fetch --prune on its own works as expected' '
80+
cd "$D" &&
81+
git clone . prune &&
82+
cd prune &&
83+
git fetch origin refs/heads/master:refs/remotes/origin/extrabranch &&
84+
85+
git fetch --prune origin &&
86+
test_must_fail git rev-parse origin/extrabranch
87+
'
88+
89+
test_expect_failure 'fetch --prune with a branch name keeps branches' '
90+
cd "$D" &&
91+
git clone . prune-branch &&
92+
cd prune-branch &&
93+
git fetch origin refs/heads/master:refs/remotes/origin/extrabranch &&
94+
95+
git fetch --prune origin master &&
96+
git rev-parse origin/extrabranch
97+
'
98+
99+
test_expect_failure 'fetch --prune with a namespace keeps other namespaces' '
100+
cd "$D" &&
101+
git clone . prune-namespace &&
102+
cd prune-namespace &&
103+
104+
git fetch --prune origin refs/heads/a/*:refs/remotes/origin/a/* &&
105+
git rev-parse origin/master
106+
'
107+
108+
test_expect_failure 'fetch --prune --tags does not delete the remote-tracking branches' '
109+
cd "$D" &&
110+
git clone . prune-tags &&
111+
cd prune-tags &&
112+
git fetch origin refs/heads/master:refs/tags/sometag &&
113+
114+
git fetch --prune --tags origin &&
115+
git rev-parse origin/master &&
116+
test_must_fail git rev-parse somebranch
117+
'
118+
119+
test_expect_failure 'fetch --prune --tags with branch does not delete other remote-tracking branches' '
120+
cd "$D" &&
121+
git clone . prune-tags-branch &&
122+
cd prune-tags-branch &&
123+
git fetch origin refs/heads/master:refs/remotes/origin/extrabranch &&
124+
125+
git fetch --prune --tags origin master &&
126+
git rev-parse origin/extrabranch
127+
'
128+
79129
test_expect_success 'fetch tags when there is no tags' '
80130
81131
cd "$D" &&

0 commit comments

Comments
 (0)