[PATCH 1/2] t3103: demonstrate dir.c:treat_one_path() core.ignorecase failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2eac2a4cc4bdc8d7 (ls-files -k: a directory only can be killed if the
index has a non-directory; 2013-08-15) adds a caller of
directory_exists_in_index(dirname,len) which forgets to satisfy the
undocumented requirement that a '/' must be present at dirname[len]
(despite being past the end-of-string). This oversight leads to
incorrect behavior when core.ignorecase is true. Demonstrate this.

Signed-off-by: Eric Sunshine <sunshine@xxxxxxxxxxxxxx>
---
 t/t3103-ls-tree-misc.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/t/t3103-ls-tree-misc.sh b/t/t3103-ls-tree-misc.sh
index 09dcf04..fd95991 100755
--- a/t/t3103-ls-tree-misc.sh
+++ b/t/t3103-ls-tree-misc.sh
@@ -4,6 +4,7 @@ test_description='
 Miscellaneous tests for git ls-tree.
 
 	      1. git ls-tree fails in presence of tree damage.
+	      2. git ls-tree acts sanely with core.ignorecase.
 
 '
 
@@ -21,4 +22,18 @@ test_expect_success 'ls-tree fails with non-zero exit code on broken tree' '
 	test_must_fail git ls-tree -r HEAD
 '
 
+test_expect_failure 'ls-tree directory core.ignorecase' '
+	cat >expect <<-\EOF &&
+	d/e/f
+	EOF
+	mkdir d &&
+	>d/e &&
+	git update-index --add -- d/e &&
+	rm d/e &&
+	mkdir d/e &&
+	>d/e/f &&
+	git -c core.ignorecase=true ls-files -k >actual &&
+	test_cmp expect actual
+'
+
 test_done
-- 
1.8.4.rc4.529.g78818d7

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]