[PATCH v3 01/11] t6301: for-each-ref tests for ref-filter APIs
From: Karthik Nayak <hidden>
Date: 2016-06-15 23:05:20
Subsystem:
the rest · Maintainer:
Linus Torvalds
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 [off-list ref] Mentored-by: Christian Couder [off-list ref] Mentored-by: Matthieu Moy [off-list ref] Signed-off-by: Karthik Nayak <redacted> --- 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