git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC/WIP PATCH 2/3] merge-recursive: fix handling of submodules in modify/delete conflicts

From
Elijah Newren <newren@gmail.com>
Date
Aug 6, 2018, 22:47 UTC
Message-ID
<20180806224745.8681-3-newren@gmail.com>
In-Reply-To
<20180806224745.8681-1-newren@gmail.com>

Similar to commit c641ca670729 ("merge-recursive: handle addition of submodule on our side of history", 2017-11-14) a submodule can be confused for a D/F conflict for modify/delete and rename/delete conflicts. (To the code, it appears there is a directory in the way of us writing our expected path to the working tree, because our path is a submodule; i.e. the submodule is itself the directory and any directory is assumed to be a D/F conflict that is in the way.) So, when we are dealing with a submodule, avoid checking the working copy for a directory being in the way.

Signed-off-by: Elijah Newren <newren@gmail.com>
---

It might be better to first check that the submodule existed on the HEAD side of the merge, because there could be a directory in the way of the submodule. But that's starting to get ugly quick, and the real fix to make this cleaner is the rewrite of merge-recursive that does an index-only merge first, then updates the working copy later...

 merge-recursive.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index 1446e92bea..4832234073 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1466,7 +1466,7 @@ static int handle_change_delete(struct merge_options *o,
 	const char *update_path = path;
 	int ret = 0;
 
-	if (dir_in_way(path, !o->call_depth, 0) ||
+	if (dir_in_way(path, !o->call_depth && !S_ISGITLINK(changed_mode), 0) ||
 	    (!o->call_depth && would_lose_untracked(path))) {
 		update_path = alt_path = unique_path(o, path, change_branch);
 	}
-- 
2.18.0.550.g44d6daf40a.dirty
Previous: Elijah NewrenNext: Elijah Newren
Message 10 of 13 in “Two RFC/WIP series for facilitating merge conflict resolution”
  1. Elijah NewrenAug 6, 2018
  2. 0/1 Simplify handling of directory/file conflictsElijah Newren, Aug 6, 2018
  3. 1/1 merge-recursive: make file/directory conflicts easier to resolveElijah Newren, Aug 6, 2018
  4. Junio C HamanoAug 9, 2018
  5. Elijah NewrenAug 9, 2018
  6. Junio C HamanoAug 9, 2018
  7. Elijah NewrenAug 9, 2018
  8. 0/3 Modifications to handling of non-textual file merge conflictsElijah Newren, Aug 6, 2018
  9. 3/3 merge-recursive: provide more conflict hints for non-textual conflictsElijah Newren, Aug 6, 2018
  10. 2/3 merge-recursive: fix handling of submodules in modify/delete conflictsElijah Newren, Aug 6, 2018
  11. 1/3 rerere: avoid buffer overrunElijah Newren, Aug 6, 2018
  12. Junio C HamanoAug 9, 2018
  13. Elijah NewrenAug 9, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.