Skip to contentSkip to conversation

t1091: cone mode list deduplicates and normalizes paths

PATCH In review Pushkar Singh 2 participants 2 messages Jan 19

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t1091: cone mode list deduplicates and normalizes paths

Ensure that git sparse-checkout list in cone mode collapses semantically identical paths (e.g. "folder1", "folder1/", and "./folder1") into a single canonical entry.

This protects user-visible behavior across different ways of specifying sparse-checkout patterns.

---
 t/t1091-sparse-checkout-builtin.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
t/t1091-sparse-checkout-builtin.sh +15 -0
index b2da4feaef..d4ed215aa5 100755
@@ -321,6 +321,21 @@ test_expect_success 'cone mode: list' '
 	test_cmp expect actual
 '
 
+test_expect_success 'cone mode: list deduplicates and normalizes paths' '
+	git -C repo sparse-checkout disable &&
+	rm -f repo/.git/info/sparse-checkout &&
+	git -C repo sparse-checkout init --cone &&
+
+	printf "folder1\nfolder1/\n./folder1\n" |
+		git -C repo sparse-checkout set --stdin &&
+
+	git -C repo sparse-checkout list >actual &&
+	cat >expect <<-\EOF &&
+	folder1
+	EOF
+	test_cmp expect actual
+'
+
 test_expect_success 'cone mode: set with nested folders' '
 	git -C repo sparse-checkout set deep deep/deeper1/deepest 2>err &&
 	test_line_count = 0 err &&
Signature · 1 line
2.43.0
#1 lore raw
Quoted 3 lines · Pushkar Singh

Ensure that git sparse-checkout list in cone mode collapses semantically identical paths (e.g. "folder1", "folder1/", and "./folder1") into a single canonical entry.

Are you aware that this is already being worked on? [1]

[1] https://lore.kernel.org/git/[email protected]/

Please contribute review to that thread with the context you've gathered creating this patch.

Thanks,
-Stolee