git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Jon Smirl <jonsmirl@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Teach git how to propagate a fix across a file split
Date: Fri, 31 Jul 2009 17:59:37 +0200	[thread overview]
Message-ID: <20090731155937.GA31427@atjola.homenet> (raw)
In-Reply-To: <9e4733910907310819x1c6fe089l75ae619b31f9feda@mail.gmail.com>

On 2009.07.31 11:19:28 -0400, Jon Smirl wrote:
> On Thu, May 14, 2009 at 5:00 PM, Jon Smirl<jonsmirl@gmail.com> wrote:
> > Are there any git merge experts looking for something to do? We just
> > hit this situation again merging some ALSA branches for 2.6.31.
> >
> > A basic problem description:
> > Pending change for 2.6.31 splits file A into A and B
> > Fix is added to 2.6.30 in file A
> > The fix in A is in a section that is going to be in file B for 2.6.31
> >
> > Merge the two branches and note that git totally messes up on the
> > merge. It can't figure out that the fix needs to go into file B.
> 
> I just hit this problem again.
> 
> It can happen in other forms. In this case I'm trying to rebase three
> year old patches forward (good old embedded vendor port and forget
> behavior). Part of these patches made a four line change to one file.
> About a year latter a 1,000 line section from this file was moved to
> another pre-existing file. When I rebase the four line change forward
> it generates a merge conflict over the entire 1,000 line section that
> was moved. This conflict is in the file the section was moved out of
> which is not what you want.
> 
> To fix this I have to search for where the 1,000 lines section was
> moved to. After I find it I can redo the four line patch.

The search can be done via blame:
git blame -C -C --reverse <old_rev>.. -- <file>

That shows the contents of <file> as of <old_rev> and where those
contents are now (as of HEAD). Of course, if the contents were changed a
lot since they were moved, the results won't be very useful, as git
simply can't find the old code in the new files anymore.

HTH
Björn

      parent reply	other threads:[~2009-07-31 15:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-14 21:00 Teach git how to propagate a fix across a file split Jon Smirl
2009-07-31 15:19 ` Jon Smirl
2009-07-31 15:42   ` Jon Smirl
2009-07-31 15:59   ` Björn Steinbrink [this message]

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=20090731155937.GA31427@atjola.homenet \
    --to=b.steinbrink@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=jonsmirl@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).