Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index afc39db086..5786645f31 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -2608,6 +2608,17 @@ int twoway_merge(const struct cache_entry * const *src,
same(current, oldtree) && !same(current, newtree)) {
/* 20 or 21 */
return merged_entry(newtree, current, o);
+ } else if (current && !oldtree && newtree &&
+ S_ISSPARSEDIR(current->ce_mode) != S_ISSPARSEDIR(newtree->ce_mode) &&
+ ce_stage(current) == 0) {
+ /*
+ * This case is a directory/file conflict across the sparse-index
+ * boundary. When we are changing from one path to another via
+ * 'git checkout', then we want to replace one entry with another
+ * via merged_entry(). If there are staged changes, then we should
+ * reject the merge instead.
+ */
+ return merged_entry(newtree, current, o);
} else
return reject_merge(current, o);
}