[PATCH v3 01/11] t6301: for-each-ref tests for ref-filter APIs
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Jun 16, 2015, 14:20 UTC
- Message-ID
- <1434464457-10749-1-git-send-email-karthik.188@gmail.com>
- In-Reply-To
- <CAOLa=ZQeZ=6mZcntR_BS_Wp0LXDzSUx9WTLXCTLxemb0e3SS0w@mail.gmail.com>
Add tests for 'for-each-ref' which utilizes the ref-filter APIs. Currently it's redundant with the tests in 't6300' but more tests will be eventually added as we implement more options into 'for-each-ref'.
Based-on-patch-by: Jeff King <peff@peff.net> Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr> Signed-off-by: Karthik Nayak <karthik.188@gmail.com> --- t/t6301-for-each-ref-filter.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 t/t6301-for-each-ref-filter.sh
diff --git a/t/t6301-for-each-ref-filter.sh b/t/t6301-for-each-ref-filter.sh new file mode 100755 index 0000000..bfcb866 --- /dev/null +++ b/t/t6301-for-each-ref-filter.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +test_description='test for-each-refs usage of ref-filter APIs' + +. ./test-lib.sh +. "$TEST_DIRECTORY"/lib-gpg.sh + +test_expect_success 'setup some history and refs' ' + test_commit one && + test_commit two && + test_commit three && + git checkout -b side && + test_commit four && + git checkout master && + git update-ref refs/odd/spot master +' + +test_expect_success 'filtering by leading name' ' + cat >expect <<-\EOF && + refs/heads/master + refs/heads/side + EOF + git for-each-ref --format="%(refname)" refs/heads >actual && + test_cmp expect actual +' + +test_expect_success 'filtering with fnmatch' ' + cat >expect <<-\EOF && + refs/tags/three + refs/tags/two + EOF + git for-each-ref --format="%(refname)" refs/tags/t* >actual && + test_cmp expect actual +' + +test_done
-- 2.4.3.436.g722e2ce.dirty