t6135: attr magic with path pattern
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>
Junio C Hamano committed
Jul 7, 2023 at 15:04 UTC
7e360bc6267e4741b75d30ec19a7461ed869a244
1 file changed
+21
-1
t/t6135-pathspec-with-attrs.sh
+21
-1
@@ -78,7 +78,17 @@ test_expect_success 'check specific set attr' '
78
test_cmp expect actual
79
'
80
81
-test_expect_success 'check specific set attr (2)' '
81
+test_expect_success 'check set attr with pathspec pattern' '
82
+ echo sub/fileSetLabel >expect &&
83
+
84
+ git ls-files ":(attr:label)sub" >actual &&
85
+ test_cmp expect actual &&
86
+
87
+ git ls-files ":(attr:label)sub/" >actual &&
88
+ test_cmp expect actual
89
+'
90
+
91
+test_expect_success 'check specific set attr in tree-ish' '
92
cat <<-\EOF >expect &&
93
HEAD:fileSetLabel
94
HEAD:sub/fileSetLabel
@@ -87,6 +97,16 @@ test_expect_success 'check specific set attr (2)' '
97
test_cmp expect actual
98
'
99
100
+test_expect_success 'check specific set attr with pathspec pattern in tree-ish' '
101
+ echo HEAD:sub/fileSetLabel >expect &&
102
+
103
+ git grep -l content HEAD ":(attr:label)sub" >actual &&
104
+ test_cmp expect actual &&
105
+
106
+ git grep -l content HEAD ":(attr:label)sub/" >actual &&
107
+ test_cmp expect actual
108
+'
109
+
110
test_expect_success 'check specific unset attr' '
111
cat <<-\EOF >expect &&
112
fileUnsetLabel