Git development
 help / color / mirror / Atom feed
* Why would merge fail on a one-line addition?
@ 2006-03-25 22:26 Marc Singer
  2006-03-26  0:31 ` Linus Torvalds
  2006-03-26  1:32 ` Junio C Hamano
  0 siblings, 2 replies; 3+ messages in thread
From: Marc Singer @ 2006-03-25 22:26 UTC (permalink / raw)
  To: Git Mailing List

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

  elf@florence ~...git/linux-2.6 > git-cat-file blob 6262d449120cdcde5db1b079806dcc0d9b5e6b7c > a
  elf@florence ~...git/linux-2.6 > git-cat-file blob dcb4e17b941990eabe8992680c9aa9b67afb6fd4 > b
  elf@florence ~...git/linux-2.6 > diff a b                                       21a22
  > #include "common.h"

Why would git have a problem with this?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Why would merge fail on a one-line addition?
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Torvalds @ 2006-03-26  0:31 UTC (permalink / raw)
  To: Marc Singer; +Cc: Git Mailing List



On Sat, 25 Mar 2006, Marc Singer wrote:

> 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
> 
>   elf@florence ~...git/linux-2.6 > git-cat-file blob 6262d449120cdcde5db1b079806dcc0d9b5e6b7c > a
>   elf@florence ~...git/linux-2.6 > git-cat-file blob dcb4e17b941990eabe8992680c9aa9b67afb6fd4 > b
>   elf@florence ~...git/linux-2.6 > diff a b                                       21a22
>   > #include "common.h"
> 
> Why would git have a problem with this?

That whole file was apparently removed in the branch you are merging into 
(no stage 2). So what should the merge do? Throw away the one-liner 
addition (likely the correct thing) or maybe it should go somewhere else 
(ie maybe it wasn't removed outright, but the contents moved into another 
file, which would now need the one-line addition).

		Linus

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Why would merge fail on a one-line addition?
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2006-03-26  1:32 UTC (permalink / raw)
  To: Marc Singer; +Cc: git

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-03-26  1:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox