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

git rerere is confused with identical conflicts in multiple files

From
MCMarkos Chandras <markos.chandras@imgtec.com>
Date
Jul 10, 2015, 08:04 UTC
Message-ID
<559F7C81.50805@imgtec.com>
Hi,
(Please keep me on CC as I am not subscribed to the list)

I am having a weird problem when merging a branch which causes some conflicts

This is the initial status for the rerere cache

$ tree .git/rr-cache .git/rr-cache [error opening dir]

0 directories, 0 files

I then go ahead and merge the said branch and I end up with the following conflicts

Auto-merging arch/mips/mm/sc-mips.c Auto-merging arch/mips/mm/c-r4k.c CONFLICT (content): Merge conflict in arch/mips/mm/c-r4k.c Auto-merging arch/mips/kernel/traps.c CONFLICT (content): Merge conflict in arch/mips/kernel/traps.c Auto-merging arch/mips/kernel/spram.c CONFLICT (content): Merge conflict in arch/mips/kernel/spram.c Auto-merging arch/mips/kernel/idle.c CONFLICT (content): Merge conflict in arch/mips/kernel/idle.c Auto-merging arch/mips/kernel/cpu-probe.c Auto-merging arch/mips/include/asm/mipsregs.h Auto-merging arch/mips/include/asm/cpu.h CONFLICT (content): Merge conflict in arch/mips/include/asm/cpu.h Auto-merging arch/mips/include/asm/cpu-type.h CONFLICT (content): Merge conflict in arch/mips/include/asm/cpu-type.h Recorded preimage for 'arch/mips/include/asm/cpu-type.h' Recorded preimage for 'arch/mips/include/asm/cpu.h' Automatic merge failed; fix conflicts and then commit the result.

As you see, git only records two preimage files instead of 6.
the rr-cache is like this now
$ tree .git/rr-cache
.git/rr-cache
├── 5563edc0fb427275a0ca5677c93c40def8b53258
│   └── preimage
└── f175ff6228f624296b661664bce4ab4e84d712cc
    └── preimage
2 directories, 2 files
and .git/MERGE_RR

$ cat .git/MERGE_RR 5563edc0fb427275a0ca5677c93c40def8b53258 arch/mips/include/asm/cpu-type.hf175ff6228f624296b661664bce4ab4e84d712cc

arch/mips/include/asm/cpu.h5563edc0fb427275a0ca5677c93c40def8b53258
   arch/mips/kernel/idle.c5563edc0fb427275a0ca5677c93c40def8b53258
arch/mips/kernel/spram.c5563edc0fb427275a0ca5677c93c40def8b53258
arch/mips/kernel/traps.c5563edc0fb427275a0ca5677c93c40def8b53258
arch/mips/mm/c-r4k.c

so as you see, multiple files share the same hash. That's probably because the "conflicting context ( the part between >>> <<<<)" in every file but cpu.h is identical and git seems to calculate the hash purely on the conflicting context. That makes git rerere thinks that it only has to resolve 2 conflicts instead of 6.

Does anyone have an idea how to resolve that? If my assumption is correct (I only looked at the git code briefly) I believe it would make sense to throw the filepath into the sha1 calculation as well in order to ensure it will not conflict with similar changes across different files.

-- 
markos
Next: Junio C Hamano
Message 1 of 3 in “git rerere is confused with identical conflicts in multiple files”
  1. Markos ChandrasJul 10, 2015
  2. Junio C HamanoJul 10, 2015
  3. Markos ChandrasJul 10, 2015

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.