git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Marc Singer <elf@buici.com>
Cc: git@vger.kernel.org
Subject: Re: Why would merge fail on a one-line addition?
Date: Sat, 25 Mar 2006 17:32:30 -0800	[thread overview]
Message-ID: <7vfyl6t2hd.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: 20060325222601.GA1500@buici.com

Marc Singer <elf@buici.com> writes:

> One of the unmerged files leaves this trail.
>
>   elf@florence ~...git/linux-2.6 > git-ls-files --unmerged
>   100644 6262d449120cdcde5db1b079806dcc0d9b5e6b7c 1       arch/arm/mach-lh7a40x/irq-lpd7a40x.c
>   100644 dcb4e17b941990eabe8992680c9aa9b67afb6fd4 3       arch/arm/mach-lh7a40x/irq-lpd7a40x.c

> Why would git have a problem with this?

Your change and the change in the other branch are conflicting
and git is helping you notice that.

The index has different #1 and #3 with #2 missing.  This means
the common ancestor (#1) had it, you (#2) _removed_ it, while
the other branch (#3) modified it.  Should it carry forward the
modification (one line addition) made by the other branch and
then remove the file to match yours, or should it remove it to
match yours and ignore what the other branch did?

If you do not want to have that file in the result, record the
path as such and make a commit.  Since there is no #2, your
working tree probably do not have that path, so:

        $ git update-index --remove arch/arm/mach-lh7a40x/irq-lpa7a40x.c

to resolve the path, resolve other conflicts if you have any and
then commit the result.

However, this _might_ be a case where your line of development
somewhere between the common ancestor and your tip moved that
file somewhere else in which case you may want to do three-way
merge between 6262d4 blob, your tip and dcb4e1 blob _and_ commit
the result at the path you have.  I do not know if that is the
case and even if so I do not know where you have the
corresponding file in your tree, but just as an example if you
have it in arch/arm/mach-foo/irq-lpd7a40x.c, you would:

	$ cd arch/arm/mach-foo/
	$ common=$(git unpack-file 6262d4)
        $ his=$(git unpack-file dcb4e1)
        $ merge irq-lpd7a40x.c $common $his
        $ rm -f $common $his

And then eyeball the result of the merge, fix it up as
necessary, and then:

	$ git update-index --remove arch/arm/mach-lh7a40x/irq-lpa7a40x.c
        $ git update-index arch/arm/mach-foo/irq-lpd7a40x.c

before committing.

      parent reply	other threads:[~2006-03-26  1:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-25 22:26 Why would merge fail on a one-line addition? Marc Singer
2006-03-26  0:31 ` Linus Torvalds
2006-03-26  1:32 ` Junio C Hamano [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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=7vfyl6t2hd.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=elf@buici.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).