Thread (58 messages) 58 messages, 3 authors, 2021-02-09

[PATCH 24/27] dir: use expand_to_path in add_patterns()

STALE2061d

From: Derrick Stolee via GitGitGadget <hidden>
Date: 2021-01-25 18:05:02
Subsystem: the rest · Maintainer: Linus Torvalds

From: Derrick Stolee <redacted>

The add_patterns() method has a way to extract a pattern file from the
index. If this pattern file is sparse and within a sparse directory
entry, then we need to expand the index before looking for that entry as
a file path.

For now, convert ensure_full_index() into expand_to_path() to only
expand this way when absolutely necessary.

Signed-off-by: Derrick Stolee <redacted>
---
 dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dir.c b/dir.c
index 21998c7c4b7..7df8d3b1da0 100644
--- a/dir.c
+++ b/dir.c
@@ -1093,7 +1093,7 @@ static int add_patterns(const char *fname, const char *base, int baselen,
 			int pos;
 
 			if (istate)
-				ensure_full_index(istate);
+				expand_to_path(istate, fname, strlen(fname), 0);
 
 			if (oid_stat->valid &&
 			    !match_stat_data_racy(istate, &oid_stat->stat, &st))
-- 
gitgitgadget
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help