All of lore.kernel.org
 help / color / mirror / Atom feed
* git merge - "both added" conflict resolution
@ 2010-08-04 20:18 Eugene Sajine
  2010-08-04 20:59 ` Jonathan Nieder
  0 siblings, 1 reply; 6+ messages in thread
From: Eugene Sajine @ 2010-08-04 20:18 UTC (permalink / raw)
  To: git

hi,

I'm trying to merge two projects into one. Both are having different
and simple set of files inside, but both have build.xml file.
Let's say i have source repo with master branch and dest repo.

When i'm trying to merge source into dest it all goes well with an
exception of the build.xml file - it has conflict. The conflict is one
liner and is easy to resolve, eventually i want it to be as it was
before the merge.
First of all, after the merge git status gives me message "both added;
build.xml" not both modified, which is understandable, but i have no
clue yet how to work with it;)

Secondly, when i resolve the conflict the build.xml returns to its
last committed state of dest repo, so git cannot determine any
changes.
Therefore, i cannot execute git add for this file and i cannot commit
my merge results, because git sees it as a partial commit.

Any ideas?

Thanks,
Eugene

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

* Re: git merge - "both added" conflict resolution
  2010-08-04 20:18 git merge - "both added" conflict resolution Eugene Sajine
@ 2010-08-04 20:59 ` Jonathan Nieder
  2010-08-04 23:29   ` Eugene Sajine
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Nieder @ 2010-08-04 20:59 UTC (permalink / raw)
  To: Eugene Sajine; +Cc: git

Hi Eugene,

Eugene Sajine wrote:

[in an add/add conflict]
>           when i resolve the conflict the build.xml returns to its
> last committed state of dest repo, so git cannot determine any
> changes.
> Therefore, i cannot execute git add for this file and i cannot commit
> my merge results

Could you explain further (preferrably with a simple example
transcript)?  I would think that after an add/add conflict,
a simple "git add" would mark the file resolved and allow
committing.

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

* Re: git merge - "both added" conflict resolution
  2010-08-04 20:59 ` Jonathan Nieder
@ 2010-08-04 23:29   ` Eugene Sajine
  2010-08-04 23:36     ` Jonathan Nieder
  0 siblings, 1 reply; 6+ messages in thread
From: Eugene Sajine @ 2010-08-04 23:29 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git

On Wed, Aug 4, 2010 at 4:59 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Hi Eugene,
>
> Eugene Sajine wrote:
>
> [in an add/add conflict]
>>           when i resolve the conflict the build.xml returns to its
>> last committed state of dest repo, so git cannot determine any
>> changes.
>> Therefore, i cannot execute git add for this file and i cannot commit
>> my merge results
>
> Could you explain further (preferrably with a simple example
> transcript)?  I would think that after an add/add conflict,
> a simple "git add" would mark the file resolved and allow
> committing.
>

Let's say in a source repository i have a master branch with few
coomits and only two files file1.java and build.xml
build.xml is as simple as few lines one of which is
...
<property name=projectName value=projectOne/>
...
In the second *unrelated* repository which is the destination for
merge I have a master branch with two files: file2.java and build.xml
this build.xml is absolutely identical with an exception of the
projectName property
...
<property name=projectName value=projectTwo/>
...

I'm doing
$ cd projecttwo (I'm in master branch)
$ git add remote temp ../projectone
$ git fetch temp
$ git merge temp/master

here i'm getting a conflict in build.xml.
file1.java is succesfully staged for commit

For build.xml git status gives me
...
both added: build.xml
...

Now i have to resolve the conflict on build.xml and as I'm merging two
projects into one it is obvious that the resolution of the conflict is
to leave the original version of build.xml

So, I'm removing all conflict markers and removing the incoming line
with the property value=projectOne leaving it as projectTwo.
This effectively means that there is no changes in build.xml for git.
And I'm stuck because i cannot add file, that is not changed and
cannot commit merge results as it is a partial commit.

Is that better;)?

Interesting enough this worked OK on git version 1.6.4.msysgit.0
But giving me headache in git 1.7.0.5 on Linux

Below is command sequence which is supposed to reflect everything above

mkdir test3
mkdir test4
cd test3/
git init
echo file content> file1.java
git add .
git commit -am "initial commit"
echo "<property name=projectname value=test3/>" > build.xml
git add .
git commit -am "add build.xml"
echo "more content" >> file1.java
git commit -am "some change"
cd ../test4
git init
echo file content> file2.java
git add .
git commit -am "initial commit"
echo "<property name=projectname value=test4/>" > build.xml
git add .
git commit -am "add build.xml"
echo "more content" >> file2.java
git commit -am "another change"
git remote add temp ../test3
git fetch temp
git merge temp/master
git status
vi build.xml
git status
git add build.xml
git st
git commit -am "merging"


Thanks,
Eugene

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

* Re: git merge - "both added" conflict resolution
  2010-08-04 23:29   ` Eugene Sajine
@ 2010-08-04 23:36     ` Jonathan Nieder
  2010-08-05 14:41       ` Eugene Sajine
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Nieder @ 2010-08-04 23:36 UTC (permalink / raw)
  To: Eugene Sajine; +Cc: git

Eugene Sajine wrote:

> So, I'm removing all conflict markers and removing the incoming line
> with the property value=projectOne leaving it as projectTwo.
> This effectively means that there is no changes in build.xml for git.
> And I'm stuck because i cannot add file, that is not changed

Sorry I wasn’t clear before.  Could you give output from attempting
to add the file?  It is supposed to work.

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

* Re: git merge - "both added" conflict resolution
  2010-08-04 23:36     ` Jonathan Nieder
@ 2010-08-05 14:41       ` Eugene Sajine
  2010-08-06 14:57         ` Eugene Sajine
  0 siblings, 1 reply; 6+ messages in thread
From: Eugene Sajine @ 2010-08-05 14:41 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git

On Wed, Aug 4, 2010 at 7:36 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Eugene Sajine wrote:
>
>> So, I'm removing all conflict markers and removing the incoming line
>> with the property value=projectOne leaving it as projectTwo.
>> This effectively means that there is no changes in build.xml for git.
>> And I'm stuck because i cannot add file, that is not changed
>
> Sorry I wasn’t clear before.  Could you give output from attempting
> to add the file?  It is supposed to work.
>


There is no output after I add build.xml with resolved conflicts. When
i do git status build.xml doesn't show up there.

I tried another way:
After i have a conflict i add the build.xml withtout resolving
conflicts. Then I unstage it - it's status changes from "both added: "
to "modified"
Then i can resolve the conflict, which means build.xml returns to it's
last committed state. But then i'm back to square one as build.xml is
not showing in changes, so i cannot add it and i still cannot commit
because of partial commit.

Thanks,
Eugene

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

* Re: git merge - "both added" conflict resolution
  2010-08-05 14:41       ` Eugene Sajine
@ 2010-08-06 14:57         ` Eugene Sajine
  0 siblings, 0 replies; 6+ messages in thread
From: Eugene Sajine @ 2010-08-06 14:57 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git

On Thu, Aug 5, 2010 at 10:41 AM, Eugene Sajine <euguess@gmail.com> wrote:
> On Wed, Aug 4, 2010 at 7:36 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
>> Eugene Sajine wrote:
>>
>>> So, I'm removing all conflict markers and removing the incoming line
>>> with the property value=projectOne leaving it as projectTwo.
>>> This effectively means that there is no changes in build.xml for git.
>>> And I'm stuck because i cannot add file, that is not changed
>>
>> Sorry I wasn’t clear before.  Could you give output from attempting
>> to add the file?  It is supposed to work.
>>
>
>
> There is no output after I add build.xml with resolved conflicts. When
> i do git status build.xml doesn't show up there.
>
> I tried another way:
> After i have a conflict i add the build.xml withtout resolving
> conflicts. Then I unstage it - it's status changes from "both added: "
> to "modified"
> Then i can resolve the conflict, which means build.xml returns to it's
> last committed state. But then i'm back to square one as build.xml is
> not showing in changes, so i cannot add it and i still cannot commit
> because of partial commit.
>
> Thanks,
> Eugene
>

When i experimenting with it with test repos - it is working OK.
So, i believe it will be very difficult to reproduce.

I'm still having this problem with two repos of mine, but as it is not
common, i gotta dig deeper there.

Thanks,
Eugene

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

end of thread, other threads:[~2010-08-06 14:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-04 20:18 git merge - "both added" conflict resolution Eugene Sajine
2010-08-04 20:59 ` Jonathan Nieder
2010-08-04 23:29   ` Eugene Sajine
2010-08-04 23:36     ` Jonathan Nieder
2010-08-05 14:41       ` Eugene Sajine
2010-08-06 14:57         ` Eugene Sajine

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.