--- v2
+++ v9
@@ -1,59 +1,28 @@
From: Derrick Stolee <dstolee@microsoft.com>
-As we further integrate the sparse-index into unpack-trees, we need to
-ensure that we compare sparse directory entries correctly with other
-entries. This affects searching for an exact path as well as sorting
-index entries.
+This fixes the test data shape to be as expected, allowing rename
+detection to work properly now that the 'larger-content' file actually
+has meaningful lines.
-Sparse directory entries contain the trailing directory separator. This
-is important for the sorting, in particular. Thus, within
-do_compare_entry() we stop using S_IFREG in all cases, since sparse
-directories should use S_IFDIR to indicate that the comparison should
-treat the entry name as a dirctory.
-
-Within compare_entry(), it first calls do_compare_entry() to check the
-leading portion of the name. When the input path is a directory name, we
-could match exactly already. Thus, we should return 0 if we have an
-exact string match on a sparse directory entry.
-
+Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
---
- unpack-trees.c | 8 +++++++-
- 1 file changed, 7 insertions(+), 1 deletion(-)
+ t/t1092-sparse-checkout-compatibility.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
-diff --git a/unpack-trees.c b/unpack-trees.c
-index 1067db19c9d2..3af797093095 100644
---- a/unpack-trees.c
-+++ b/unpack-trees.c
-@@ -969,6 +969,7 @@ static int do_compare_entry(const struct cache_entry *ce,
- int pathlen, ce_len;
- const char *ce_name;
- int cmp;
-+ unsigned ce_mode;
+diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
+index b8617ceef71..87f1014a1c9 100755
+--- a/t/t1092-sparse-checkout-compatibility.sh
++++ b/t/t1092-sparse-checkout-compatibility.sh
+@@ -40,7 +40,7 @@ test_expect_success 'setup' '
+ done &&
- /*
- * If we have not precomputed the traverse path, it is quicker
-@@ -991,7 +992,8 @@ static int do_compare_entry(const struct cache_entry *ce,
- ce_len -= pathlen;
- ce_name = ce->name + pathlen;
-
-- return df_name_compare(ce_name, ce_len, S_IFREG, name, namelen, mode);
-+ ce_mode = S_ISSPARSEDIR(ce->ce_mode) ? S_IFDIR : S_IFREG;
-+ return df_name_compare(ce_name, ce_len, ce_mode, name, namelen, mode);
- }
-
- static int compare_entry(const struct cache_entry *ce, const struct traverse_info *info, const struct name_entry *n)
-@@ -1000,6 +1002,10 @@ static int compare_entry(const struct cache_entry *ce, const struct traverse_inf
- if (cmp)
- return cmp;
-
-+ /* If ce is a sparse directory, then allow an exact match. */
-+ if (S_ISSPARSEDIR(ce->ce_mode))
-+ return 0;
-+
- /*
- * Even if the beginning compared identically, the ce should
- * compare as bigger than a directory leading up to it!
+ git checkout -b rename-base base &&
+- echo >folder1/larger-content <<-\EOF &&
++ cat >folder1/larger-content <<-\EOF &&
+ matching
+ lines
+ help
--
gitgitgadget