git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] t6135: attr magic with path pattern

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 7, 2023, 22:04 UTC
Message-ID
<20230707220457.3655121-2-gitster@pobox.com>
In-Reply-To
<20230707220457.3655121-1-gitster@pobox.com>

The test coverage on attribute magic combined with path pattern was a bit thin. Let's add a few and make sure "(attr:X)sub" and "(attr:X)sub/" behave the same.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t6135-pathspec-with-attrs.sh | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/t/t6135-pathspec-with-attrs.sh b/t/t6135-pathspec-with-attrs.sh
index 457cc167c7..f63774094f 100755
--- a/t/t6135-pathspec-with-attrs.sh
+++ b/t/t6135-pathspec-with-attrs.sh
@@ -78,7 +78,17 @@ test_expect_success 'check specific set attr' '
 	test_cmp expect actual
 '
 
-test_expect_success 'check specific set attr (2)' '
+test_expect_success 'check set attr with pathspec pattern' '
+	echo sub/fileSetLabel >expect &&
+
+	git ls-files ":(attr:label)sub" >actual &&
+	test_cmp expect actual &&
+
+	git ls-files ":(attr:label)sub/" >actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'check specific set attr in tree-ish' '
 	cat <<-\EOF >expect &&
 	HEAD:fileSetLabel
 	HEAD:sub/fileSetLabel
@@ -87,6 +97,16 @@ test_expect_success 'check specific set attr (2)' '
 	test_cmp expect actual
 '
 
+test_expect_success 'check specific set attr with pathspec pattern in tree-ish' '
+	echo HEAD:sub/fileSetLabel >expect &&
+
+	git grep -l content HEAD ":(attr:label)sub" >actual &&
+	test_cmp expect actual &&
+
+	git grep -l content HEAD ":(attr:label)sub/" >actual &&
+	test_cmp expect actual
+'
+
 test_expect_success 'check specific unset attr' '
 	cat <<-\EOF >expect &&
 	fileUnsetLabel
-- 
2.41.0-318-g061c58647e
Previous: René Scharfe
Message 9 of 9 in “Fix attr magic combined with pathspec prefix”
  1. 0/2 Fix attr magic combined with pathspec prefixJunio C Hamano, Jul 7, 2023
  2. 2/2 dir: do not feed path suffix to pathspec matchJunio C Hamano, Jul 7, 2023
  3. dir: do not feed path suffix to pathspec matchJunio C Hamano, Jul 7, 2023
  4. René ScharfeJul 8, 2023
  5. dir: match "attr" pathspec magic with correct pathsJunio C Hamano, Jul 8, 2023
  6. René ScharfeJul 9, 2023
  7. Junio C HamanoJul 9, 2023
  8. René ScharfeJul 8, 2023
  9. 1/2 t6135: attr magic with path patternJunio C Hamano, Jul 7, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.