aboutsummaryrefslogtreecommitdiffstats
path: root/merge-ort.c
diff options
context:
space:
mode:
Diffstat (limited to 'merge-ort.c')
-rw-r--r--merge-ort.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/merge-ort.c b/merge-ort.c
index 1531b4c94c..805f7c4139 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -4060,11 +4060,18 @@ static int record_conflicted_index_entries(struct merge_options *opt)
/*
* We are in a conflicted state. These conflicts might be inside
- * sparse-directory entries, so expand the index preemptively.
- * Also, we set original_cache_nr below, but that might change if
+ * sparse-directory entries, so check if any entries are outside
+ * of the sparse-checkout cone preemptively.
+ *
+ * We set original_cache_nr below, but that might change if
* index_name_pos() calls ask for paths within sparse directories.
*/
- ensure_full_index(index);
+ strmap_for_each_entry(&opt->priv->conflicted, &iter, e) {
+ if (!path_in_sparse_checkout(e->key, index)) {
+ ensure_full_index(index);
+ break;
+ }
+ }
/* If any entries have skip_worktree set, we'll have to check 'em out */
state.force = 1;