public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Markos Chandras <Markos.Chandras@imgtec•com>
To: <git@vger•kernel.org>
Subject: git rerere is confused with identical conflicts in multiple files
Date: Fri, 10 Jul 2015 09:04:17 +0100	[thread overview]
Message-ID: <559F7C81.50805@imgtec.com> (raw)

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

             reply	other threads:[~2015-07-10  8:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-10  8:04 Markos Chandras [this message]
2015-07-10 14:13 ` git rerere is confused with identical conflicts in multiple files Junio C Hamano
2015-07-10 15:21   ` Markos Chandras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=559F7C81.50805@imgtec.com \
    --to=markos.chandras@imgtec$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox