git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Git merge driver / attributes bug in 2.3.1?
@ 2015-03-05 13:30 Gondek, Andreas
  2015-03-05 18:55 ` Junio C Hamano
  2015-03-06 11:25 ` Michael J Gruber
  0 siblings, 2 replies; 8+ messages in thread
From: Gondek, Andreas @ 2015-03-05 13:30 UTC (permalink / raw)
  To: git@vger.kernel.org

Hello,

after upgrading the Git installation on one of our development servers from 1.9.0-rc3 to 2.3.1 we are experiencing strange behavior of merge drivers.

A merge driver registered as "* merge=<name_of_merge_driver>" in the .gitattributes is now executed even if there isn't any merge conflict. This only happens for files that are part of the merge.

This is reproducible in test repositories.

Greetings

Andreas Gondek
Applications
________________________________

Deutsche WertpapierService Bank AG
ITTAS
Derendorfer Allee 2
40476 Düsseldorf
Tel.: +49 69 5099 9503
Fax: +49 69 5099 85 9503
E-Mail: Andreas.Gondek@dwpbank.de
http://www.dwpbank.de

Deutsche WertpapierService Bank AG | Wildunger Straße 14 | 60487 Frankfurt am Main
Sitz der AG: Frankfurt am Main, HRB 56913 | USt.-ID: DE 813759005
Vorstand: Thomas Klanten, Dr. Christian Tonnesen
Aufsichtsrat: Wilfried Groos (Vors.) 

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

* Re: Git merge driver / attributes bug in 2.3.1?
  2015-03-05 13:30 Git merge driver / attributes bug in 2.3.1? Gondek, Andreas
@ 2015-03-05 18:55 ` Junio C Hamano
  2015-03-06 11:25 ` Michael J Gruber
  1 sibling, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2015-03-05 18:55 UTC (permalink / raw)
  To: Gondek, Andreas; +Cc: git@vger.kernel.org

"Gondek, Andreas" <Andreas.Gondek@dwpbank.de> writes:

> after upgrading the Git installation on one of our development servers
> from 1.9.0-rc3 to 2.3.1 we are experiencing strange behavior of merge
> drivers.

Do you see the same with something slightly older, like say v2.2.0?

The only change that I can think of offhand that may be related is
6ea358f7 (ll-merge.c: refactor `read_merge_config()` to use
`git_config_string()`, 2014-08-13) that went into v2.2.0, but I
don't immediately see how that would be related X-<.

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

* Re: Git merge driver / attributes bug in 2.3.1?
  2015-03-05 13:30 Git merge driver / attributes bug in 2.3.1? Gondek, Andreas
  2015-03-05 18:55 ` Junio C Hamano
@ 2015-03-06 11:25 ` Michael J Gruber
  2015-03-06 13:31   ` AW: " Gondek, Andreas
  1 sibling, 1 reply; 8+ messages in thread
From: Michael J Gruber @ 2015-03-06 11:25 UTC (permalink / raw)
  To: Gondek, Andreas, git@vger.kernel.org

Gondek, Andreas venit, vidit, dixit 05.03.2015 14:30:
> Hello,
> 
> after upgrading the Git installation on one of our development
> servers from 1.9.0-rc3 to 2.3.1 we are experiencing strange behavior
> of merge drivers.
> 
> A merge driver registered as "* merge=<name_of_merge_driver>" in the
> .gitattributes is now executed even if there isn't any merge
> conflict. This only happens for files that are part of the merge.
> 
> This is reproducible in test repositories.

Can you share a minimal test repo?

I've been trying to reproduce this, unsuccessfully so far.

I guess it depends on how exactly those files are "part of the merge",
and how the merge driver is set up. (I've tried with and without recursive.)

Michael

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

* AW: Git merge driver / attributes bug in 2.3.1?
  2015-03-06 11:25 ` Michael J Gruber
@ 2015-03-06 13:31   ` Gondek, Andreas
  2015-03-06 14:12     ` Michael J Gruber
  0 siblings, 1 reply; 8+ messages in thread
From: Gondek, Andreas @ 2015-03-06 13:31 UTC (permalink / raw)
  To: Michael J Gruber, git@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 1641 bytes --]

The archive contains my test repository, the merge driver and the .gitconfig of the user. We don't have a global .gitconfig.

Mit freundlichen Grüßen

Andreas Gondek
Applications
________________________________

Deutsche WertpapierService Bank AG
ITTAS
Derendorfer Allee 2
40476 Düsseldorf
Tel.: +49 69 5099 9503
Fax: +49 69 5099 85 9503
E-Mail: Andreas.Gondek@dwpbank.de
http://www.dwpbank.de

Deutsche WertpapierService Bank AG | Wildunger Straße 14 | 60487 Frankfurt am Main 
Sitz der AG: Frankfurt am Main, HRB 56913 | USt.-ID: DE 813759005 
Vorstand: Thomas Klanten, Dr. Christian Tonnesen
Aufsichtsrat: Wilfried Groos (Vors.)
-----Ursprüngliche Nachricht-----
Von: Michael J Gruber [mailto:git@drmicha.warpmail.net] 
Gesendet: Freitag, 6. März 2015 12:26
An: Gondek, Andreas; git@vger.kernel.org
Betreff: Re: Git merge driver / attributes bug in 2.3.1?

Gondek, Andreas venit, vidit, dixit 05.03.2015 14:30:
> Hello,
> 
> after upgrading the Git installation on one of our development servers 
> from 1.9.0-rc3 to 2.3.1 we are experiencing strange behavior of merge 
> drivers.
> 
> A merge driver registered as "* merge=<name_of_merge_driver>" in the 
> .gitattributes is now executed even if there isn't any merge conflict. 
> This only happens for files that are part of the merge.
> 
> This is reproducible in test repositories.

Can you share a minimal test repo?

I've been trying to reproduce this, unsuccessfully so far.

I guess it depends on how exactly those files are "part of the merge", and how the merge driver is set up. (I've tried with and without recursive.)

Michael

[-- Attachment #2: testRepo.zip --]
[-- Type: application/x-zip-compressed, Size: 30277 bytes --]

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

* Re: Git merge driver / attributes bug in 2.3.1?
  2015-03-06 13:31   ` AW: " Gondek, Andreas
@ 2015-03-06 14:12     ` Michael J Gruber
  2015-03-06 21:30       ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Michael J Gruber @ 2015-03-06 14:12 UTC (permalink / raw)
  To: Gondek, Andreas, git@vger.kernel.org

Gondek, Andreas venit, vidit, dixit 06.03.2015 14:31:
> The archive contains my test repository, the merge driver and the .gitconfig of the user. We don't have a global .gitconfig.

Thanks for the test repo!

Alas, the merge driver gets executed with v1.9.0-rc3, v1.8.5 and v1.7.0,
at least over here - as it should be because of the conflict: two
patches changing the same file. That conflict can be resolved
automatically by the internal driver, of course. Maybe something else
changed during the upgrade?

Michael

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

* Re: Git merge driver / attributes bug in 2.3.1?
  2015-03-06 14:12     ` Michael J Gruber
@ 2015-03-06 21:30       ` Junio C Hamano
  2015-03-09  9:02         ` AW: " Gondek, Andreas
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2015-03-06 21:30 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Gondek, Andreas, git@vger.kernel.org

Michael J Gruber <git@drmicha.warpmail.net> writes:

> Gondek, Andreas venit, vidit, dixit 06.03.2015 14:31:
>> The archive contains my test repository, the merge driver and the
> .gitconfig of the user. We don't have a global .gitconfig.
>
> Thanks for the test repo!
>
> Alas, the merge driver gets executed with v1.9.0-rc3, v1.8.5 and v1.7.0,
> at least over here - as it should be because of the conflict: two
> patches changing the same file. That conflict can be resolved
> automatically by the internal driver, of course.

That matches my expectation.  The whole point to have the merge
driver plug-in mechanism is to allow overriding the internal textual
3-way file-level merge, so we would have always called out to the
custom driver when the tree-level merge machinery says that the
content needs a file-level merge [*1*].


[Footnote]

*1* This is a tangent, but I've been wondering if we want some cases
where the tree-level merge machinery currently says that there is no
need for file-level merge to be fed to the merge driver.

Specifically, the tree-level merge machinery considers a case where
you and the other party changed the files identically to be cleanly
merged, but for contents of certain nature, that may not be always
desirable.

Imagine that I and my wife are sharing a note to record what is in
our refrigerator.  After I buy a carton of milk, I'd do

    $ echo "1 carton of milk" >>fridge.txt
    $ git commit && git push

and my wife would do the same.

    $ echo "1 carton of milk" >>fridge.txt
    $ git commit && git push

which would not fast-forward, and then she would

    $ git pull

which would result in only one carton of milk in our fridge, even
though when both of us got home, we will realize that we now have
two of them.

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

* AW: Git merge driver / attributes bug in 2.3.1?
  2015-03-06 21:30       ` Junio C Hamano
@ 2015-03-09  9:02         ` Gondek, Andreas
  2015-03-09  9:35           ` Michael J Gruber
  0 siblings, 1 reply; 8+ messages in thread
From: Gondek, Andreas @ 2015-03-09  9:02 UTC (permalink / raw)
  To: Junio C Hamano, Michael J Gruber; +Cc: git@vger.kernel.org

We used a merge driver to create a conflict semaphore file whenever a merge conflict occurs in Atlassian Stash. This worked for several month until we got to update our Git version because of another problem.

If I understand it correctly, a merge driver is executed before the normal internal merge happens? So I would need to call a git merge-file in my merge driver, test the result and return the exit code of the git merge-file?

Greetings

Andreas Gondek
Applications
________________________________

Deutsche WertpapierService Bank AG
ITTAS
Derendorfer Allee 2
40476 Düsseldorf
Tel.: +49 69 5099 9503
Fax: +49 69 5099 85 9503
E-Mail: Andreas.Gondek@dwpbank.de
http://www.dwpbank.de

Deutsche WertpapierService Bank AG | Wildunger Straße 14 | 60487 Frankfurt am Main 
Sitz der AG: Frankfurt am Main, HRB 56913 | USt.-ID: DE 813759005 
Vorstand: Thomas Klanten, Dr. Christian Tonnesen
Aufsichtsrat: Wilfried Groos (Vors.)

-----Ursprüngliche Nachricht-----
Von: Junio C Hamano [mailto:gitster@pobox.com] 
Gesendet: Freitag, 6. März 2015 22:30
An: Michael J Gruber
Cc: Gondek, Andreas; git@vger.kernel.org
Betreff: Re: Git merge driver / attributes bug in 2.3.1?

Michael J Gruber <git@drmicha.warpmail.net> writes:

> Gondek, Andreas venit, vidit, dixit 06.03.2015 14:31:
>> The archive contains my test repository, the merge driver and the
> .gitconfig of the user. We don't have a global .gitconfig.
>
> Thanks for the test repo!
>
> Alas, the merge driver gets executed with v1.9.0-rc3, v1.8.5 and 
> v1.7.0, at least over here - as it should be because of the conflict: 
> two patches changing the same file. That conflict can be resolved 
> automatically by the internal driver, of course.

That matches my expectation.  The whole point to have the merge driver plug-in mechanism is to allow overriding the internal textual 3-way file-level merge, so we would have always called out to the custom driver when the tree-level merge machinery says that the content needs a file-level merge [*1*].


[Footnote]

*1* This is a tangent, but I've been wondering if we want some cases where the tree-level merge machinery currently says that there is no need for file-level merge to be fed to the merge driver.

Specifically, the tree-level merge machinery considers a case where you and the other party changed the files identically to be cleanly merged, but for contents of certain nature, that may not be always desirable.

Imagine that I and my wife are sharing a note to record what is in our refrigerator.  After I buy a carton of milk, I'd do

    $ echo "1 carton of milk" >>fridge.txt
    $ git commit && git push

and my wife would do the same.

    $ echo "1 carton of milk" >>fridge.txt
    $ git commit && git push

which would not fast-forward, and then she would

    $ git pull

which would result in only one carton of milk in our fridge, even though when both of us got home, we will realize that we now have two of them.

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

* Re: Git merge driver / attributes bug in 2.3.1?
  2015-03-09  9:02         ` AW: " Gondek, Andreas
@ 2015-03-09  9:35           ` Michael J Gruber
  0 siblings, 0 replies; 8+ messages in thread
From: Michael J Gruber @ 2015-03-09  9:35 UTC (permalink / raw)
  To: Gondek, Andreas, Junio C Hamano; +Cc: git@vger.kernel.org

Gondek, Andreas venit, vidit, dixit 09.03.2015 10:02:
> We used a merge driver to create a conflict semaphore file whenever a
> merge conflict occurs in Atlassian Stash. This worked for several
> month until we got to update our Git version because of another
> problem.

That is the first issue: Can you reproduce with an older Git and your
test repo the effect that you wanted to achieve?

I have tried a few older Git's with your test repo, and I always get the
same behavior as with current Git (and as we would expect). So,
something else has to be going on here.

> If I understand it correctly, a merge driver is executed before the
> normal internal merge happens? So I would need to call a git
> merge-file in my merge driver, test the result and return the exit
> code of the git merge-file?

First, the tree level merge checks whether the two sides introduce
different changes to the same files. If not a simple tree level merge is
done (which may or may not be OK, see Junio's shopping list example).

If yes (different changes to the same files), a merge driver is used,
either an external one if specified, or the internal 3-way merge driver.
But I'm not a merge expert ;)

If I understand correctly, you want to use the external merge driver to
signal a conflict that git may miss otherwise?

On a side note, this discussion and the shopping list example show how
badly a tool like git-dep(endency) can go wrong, just like the automatic
merge. Just imagine a library change on one branch, and the introduction
of a new call site following the old library calling convention on
another branch. No dependency detected, clean tree-level merge by git,
and fails to compile (hopefully) or run (worse). Automatic mergers can
only guess, they are no code analyzers.

Michael

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

end of thread, other threads:[~2015-03-09  9:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-05 13:30 Git merge driver / attributes bug in 2.3.1? Gondek, Andreas
2015-03-05 18:55 ` Junio C Hamano
2015-03-06 11:25 ` Michael J Gruber
2015-03-06 13:31   ` AW: " Gondek, Andreas
2015-03-06 14:12     ` Michael J Gruber
2015-03-06 21:30       ` Junio C Hamano
2015-03-09  9:02         ` AW: " Gondek, Andreas
2015-03-09  9:35           ` Michael J Gruber

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).