]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t6120: test name-rev --all and --stdin
authorMichael J Gruber <git@grubix.eu>
Thu, 7 Sep 2017 14:02:21 +0000 (16:02 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 8 Sep 2017 01:37:24 +0000 (10:37 +0900)
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>
t/t6120-describe.sh

index aa74eb8f0d5dfb4f228b1e8c7b9dbbc0b88adb4d..7c5728ebd574ce133567da0c8cc50fe5e7c1f5ab 100755 (executable)
@@ -198,6 +198,31 @@ test_expect_success 'name-rev with exact tags' '
        test_cmp expect actual
 '
 
+test_expect_success 'name-rev --all' '
+       >expect.unsorted &&
+       for rev in $(git rev-list --all)
+       do
+               git name-rev $rev >>expect.unsorted
+       done &&
+       sort <expect.unsorted >expect &&
+       git name-rev --all >actual.unsorted &&
+       sort <actual.unsorted >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'name-rev --stdin' '
+       >expect.unsorted &&
+       for rev in $(git rev-list --all)
+       do
+               name=$(git name-rev --name-only $rev) &&
+               echo "$rev ($name)" >>expect.unsorted
+       done &&
+       sort <expect.unsorted >expect &&
+       git rev-list --all | git name-rev --stdin >actual.unsorted &&
+       sort <actual.unsorted >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success 'describe --contains with the exact tags' '
        echo "A^0" >expect &&
        tag_object=$(git rev-parse refs/tags/A) &&