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

Re: Trouble merging renamed but identical files - CONFLICT (rename/rename)

From
Phil Hord <phil.hord@gmail.com>
Date
Jun 30, 2014, 01:42 UTC
Message-ID
<CABURp0pwWRjocTbbRLG4tkd_W8ZPswMzwoUhe4geUF6bGdVoKQ@mail.gmail.com>
In-Reply-To
<CBA6D67B4439423CB4F73F3DD3C08952@black>
On Sun, Jun 29, 2014 at 5:13 PM, Jason Pyeron <jpyeron@pdinc.us> wrote:
Show 47 quoted lines
>> -----Original Message-----
>> From: Phil Hord
>> Sent: Sunday, June 29, 2014 16:27
>>
>> On Sun, Jun 29, 2014 at 4:20 PM, Jason Pyeron
>> <jpyeron@pdinc.us> wrote:
>> >> -----Original Message-----
>> >> From: Phil Hord
>> >> Sent: Sunday, June 29, 2014 16:09
>> >>
>> >> On Sun, Jun 29, 2014 at 11:31 AM, Phil Hord
>> >> <phil.hord@gmail.com> wrote:
>> >> > On Fri, Jun 27, 2014 at 8:42 PM, Jason Pyeron
>> >> <jpyeron@pdinc.us> wrote:
>> >> >> Sorry for the http://pastebin.com/1R68v6jt (changes the merge to
>> >> >> 1ca13ed2271d60ba93d40bcc8db17ced8545f172, and manually
>> >> reconciles the merge),
>> >> >> but it was too long to be readable in the email.
>> >>
>> >> Ok, I think I understand the issue you are trying to solve now.
>> >>
>> >> Git (rather famously[1]) does not record renames or copies.  It is
>> >> expected instead that renames and copies will be detected
>> when it is
>> >> important after the fact. This allows us to ignore rename detection
>> >> and resolution when creating project history; in the future, better
>> >> rename/copy detection will "just work" on existing repositories and
>> >> the repos themselves will not need to be adjusted.
>> >
>> > Looking at http://pastebin.com/1R68v6jt , I have a work around.
>> >
>> > In summary, 7.git cherry-pick -x HEAD..rebranding , then
>> >
>> > git merge $(echo 'Merge of
>> 1ca13ed2271d60ba93d40bcc8db17ced8545f172 branch -
>> > rebranding' |\
>> >     git commit-tree -p HEAD -p rebranding \
>> >          $(git cat-file -p HEAD | grep ^tree | sed -e
>> 's/^tree //') )
>> >
>> > Now it is perfect in the blame and log --graph.
>>
>> Yes, but your workaround unnecessarily duplicates commits and
>> complicates the history of your project. You are munging your project
>
> But I want to avoid thet complicating, while still showing that line 42 was
> modified by X. Should this be possible with a merge, without using cherry-pick?

I think it should. But there are other complications in your project which may be getting in the way. You are merging two branches with no common ancestor. When git walks down either path looking for the source commit for each line, it finds two sources for it. For example, it reaches commit 39ebb06 which appears to be the origin of all lines in that file since it has no parent. I imagine this could act as a short-circuit to further searching. Furthermore, I'm not sure how git should know any better.

It seems you already have a merge point for these two branches, but I haven't looked deeply into how that merge was done. But I think the multiple disconnected branch histories may be the cause of the confusion.

> Btw I am not able to pull up https://git.wiki.kernel.org/ or
> http://git.wiki.kernel.org/
That is strange.  It works for me here, and I am just a user like you.
Phil
Previous: Jason Pyeron
Message 12 of 12 in “Trouble merging renamed but identical files - CONFLICT (rename/rename)”
  1. Jason PyeronJun 27, 2014
  2. Phil HordJun 27, 2014
  3. Jason PyeronJun 27, 2014
  4. Phil HordJun 29, 2014
  5. Jason PyeronJun 28, 2014
  6. Jason PyeronJun 28, 2014
  7. Phil HordJun 29, 2014
  8. Phil HordJun 29, 2014
  9. Jason PyeronJun 29, 2014
  10. Phil HordJun 29, 2014
  11. Jason PyeronJun 29, 2014
  12. Phil HordJun 30, 2014

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.