t6120: test name-rev --all and --stdin

name-rev is used in a few tests, but tested only in t6120 along with describe so far. Add tests for name-rev with --all and --stdin. Signed-off-by: Michael J Gruber <git@grubix.eu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael J Gruber committed Sep 7, 2017 at 16:02 UTC a24fa652962007e03ac02e25952bf45ddff5bfde
1 file changed +25
t/t6120-describe.sh
+25
@@ -198,6 +198,31 @@ test_expect_success 'name-rev with exact tags' '
198 test_cmp expect actual
199 '
200
201 +test_expect_success 'name-rev --all' '
202 + >expect.unsorted &&
203 + for rev in $(git rev-list --all)
204 + do
205 + git name-rev $rev >>expect.unsorted
206 + done &&
207 + sort <expect.unsorted >expect &&
208 + git name-rev --all >actual.unsorted &&
209 + sort <actual.unsorted >actual &&
210 + test_cmp expect actual
211 +'
212 +
213 +test_expect_success 'name-rev --stdin' '
214 + >expect.unsorted &&
215 + for rev in $(git rev-list --all)
216 + do
217 + name=$(git name-rev --name-only $rev) &&
218 + echo "$rev ($name)" >>expect.unsorted
219 + done &&
220 + sort <expect.unsorted >expect &&
221 + git rev-list --all | git name-rev --stdin >actual.unsorted &&
222 + sort <actual.unsorted >actual &&
223 + test_cmp expect actual
224 +'
225 +
226 test_expect_success 'describe --contains with the exact tags' '
227 echo "A^0" >expect &&
228 tag_object=$(git rev-parse refs/tags/A) &&