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

Re: [RFC/WIP PATCH 0/3] Modifications to handling of non-textual file merge conflicts

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 9, 2018, 17:52 UTC
Message-ID
<xmqq600jctr1.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180806224745.8681-1-newren@gmail.com>
Elijah Newren <newren@gmail.com> writes:
Show 21 quoted lines
> 1) Representative example: A modify/delete conflict; the path in question
> in the working tree would have conflict information at the top of the file
> followed by the normal file contents; thus it could be of the form:
>
>     <<<<<<<< HEAD
>     Conflict hint: This block of text was not part of the original
>     branch; it serves instead to hint about non-textual conflicts:
>       MODIFY/DELETE: path foo modified in HEAD and deleted in BRANCH
>     ========
>     Conflict hint: This block of text was not part of the original
>     branch; it serves instead to hint about non-textual conflicts:
>       MODIFY/DELETE: path foo modified in HEAD and deleted in BRANCH
>     >>>>>>>> BRANCH
>     Lorem ipsum dolor sit amet, consectetuer sadipscing elitr,
>     sed diam nonumy eirmod tempor invidunt ut labore et dolore
>     magna aliquyam erat, sed diam voluptua. At vero eos et
>     accusam et justo duo dolores et ea rebum. Stet clita kasd
>     gubergren, no sea takimata sanctus est Lorem ipsum dolor
>     sit amet.
>
> Alternative ideas for handling the explanatory text here are welcome.

In a modify/delete conflict, we currently do not leave any in-file clue, so smudging the modified side like this might be a change that helps those who "grep e '<<<<<<<'" to find the set of paths that need to be examined. I personally do not feel it would be all that useful, as "ls-files -u" is how I'd learn about these paths.

What I would want to see when faced to a modify/delete conflict is how the modification side changed the contents, as the change, or its moral equivalent, would need to be ported to other locations in the context of the deleting side. But I am not sure if it makes sense to attempt to somehow include "diff HEAD...MERGE_HEAD" (or the other way around) in the file to show the contents change on the modification side.

Show 34 quoted lines
> 2) Representative example: A binary edit/edit conflict.  In this case,
> it would be inappropriate to put the conflict markers inside the
> binary file.  Instead, we create another file (e.g. path~CONFLICTS)
> and put conflict markers in it:
>
>     <<<<<<<< HEAD
>     Conflict hint: This block of text was not part of the original
>     branch; it serves instead to hint about non-textual conflicts:
>       BINARY conflict: path foo modified in both branches
>     ========
>     Conflict hint: This block of text was not part of the original
>     branch; it serves instead to hint about non-textual conflicts:
>       BINARY conflict: path foo modified in both branches
>     >>>>>>>> BRANCH
>
> This file would also be added to the index at stage 1 (so that 'git merge
> --abort' would clean this file out instead of leaving it around untracked,
> and also because 'git status' would report "deleted in both" which seems
> reasonable).
>
> This type of example could apply for each of the following types of
> conflicts:
>   * binary edit/edit
>   * any of the conflicts from type 1 when binary files are involved
>   * symlink edit/edit (or add/add)
>   * symlink/submodule
>   * symlink/directory
>   * directory/submodule
>   * submodule/submodule
>
> It could also apply to the following new corner case conflict types from
> directory rename detection:
>   * N-way colliding paths (N>=2) due to directory renames
>   * directory rename split; half renamed to one directory and half to another

Hmph, I am starting to wonder if it may be easier to access if instead you did not touch any working tree file to do any of the above, and instead write a single file in $GIT_DIR/ to explain what kind of conflicts these paths are involved in. That would probably give a better and easier-to-read summary than "ls-files -u" output.

Or do we have _enough_ information in the "ls-files -u" already to infer "Ah, we are in symlink edit/edit conflict.", etc.? If so, perhaps "git status" can be extended to show what kind of conflict these paths are in by reading the higher-stage index entries (and lack of stages thereof, when dealing with a conflict with deletion involved)?

Previous: Elijah NewrenNext: Elijah Newren
Message 12 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.