t5510: add tests for fetch --prune

The failures will be fixed in later commits. Signed-off-by: Carlos Martín Nieto <cmn@elego.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Carlos Martín Nieto committed Oct 8, 2011 at 00:51 UTC 43a8a04a11d9c3870a4b20fb2d82f89631390e0a
1 file changed +50
t/t5510-fetch.sh
+50
@@ -76,6 +76,56 @@ test_expect_success "fetch test for-merge" '
76 cut -f -2 .git/FETCH_HEAD >actual &&
77 test_cmp expected actual'
78
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 +
129 test_expect_success 'fetch tags when there is no tags' '
130
131 cd "$D" &&