[PATCH 24/27] dir: use expand_to_path in add_patterns()
- From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Jan 25, 2021, 17:42 UTC
- Message-ID
- <926a2e12cf7534339e1f9bedff50d97bf251ffa2.1611596534.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.847.git.1611596533.gitgitgadget@gmail.com>
From: Derrick Stolee <dstolee@microsoft.com>
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 <dstolee@microsoft.com> --- 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