How to find and analyze bad merges?

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

How to find and analyze bad merges?

Norbert Nemec
Hi there,

one of our senior developers just desperately tried to find out why a
bugfix that he once committed and merged into the master got lost on the
way. Took us a long time to reconstruct:

Same file modified on two branches:
branch A: small bugfix in a few lines
branch B: major refactoring of the file
Merging A&B resulted in a conflict. The user doing the merge erraneously
resolved the conflict by picking the version from branch B, eliminating
the bugfix on branch A.

Trying to identify the problem was rather tricky:

Obviously, a merged file that is resolved by choosing the complete
version from one parent is not considered significant part of the
history of this file.

a) the log-view for only the file in question does *not* include the
critical merge commit that actually caused the problem.

b) viewing the merge commit itself does *not* include this file.

In my understanding, a merge commit should display all files that had
conflicts that needed resolving of any kind. Even if the resolution was
simple (choose B), the decision to do so was non-trivial and had
significant effect on the file (silently losing the bugfix).

I am not sure whether this issue can be resolved within SmartGIT or
whether it is a more fundamental git issue. In the manpage for
"git log", I found the paragraph about "History Simplification" which
seems to relate to this issue. I don't know, though, in which way the
log is obtained by SmartGIT and whether this could be tuned.

Greetings,
Norbert


--
Dr. Norbert Nemec
Teamleader Software Development

Tel +49-30-611035-1882
[hidden email]

KOMPLETE 8 ULTIMATE - the premium NI producer collection
=>  http://www.native-instruments.com/komplete8

TRAKTOR KONTROL S2 - the professional 2.1 DJ system
=>  http://www.native-instruments.com/s2

->>>>>> NATIVE INSTRUMENTS - The Future of Sound <<<<<<-

Registergericht: Amtsgericht Charlottenburg
Registernummer: HRB 72458
UST.-ID.-Nr. DE 20 374 7747

Geschäftsführung: Daniel Haver (CEO), Mate Galic


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/smartgit/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/smartgit/join
    (Yahoo! ID required)

<*> To change settings via email:
    [hidden email]
    [hidden email]

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply | Threaded
Open this post in threaded view
|

Re: How to find and analyze bad merges?

syntevo Support
> Obviously, a merged file that is resolved by choosing the complete
> version from one parent is not considered significant part of the
> history of this file.

Interesting point.

> a) the log-view for only the file in question does *not* include the
> critical merge commit that actually caused the problem.

Current SmartGit logic is to include a merge commit, if the file's content is different compared to *all* of its parents. For the latest build I've now implemented the approach to include a merge commit if it is different to *any* of its parents. To enable, you need to have system property "smartgit.log.report-insignificant-merges" set to "true". For smartgit.git repository, resulting File Logs look reasonable, though Log might be cluttered now with many "insignificant" merge commits in case of many branches. Hence, feedback on this option is appreciated:

http://www.syntevo.com/smartgit/intermediate-eap-builds.html

> b) viewing the merge commit itself does *not* include this file.
>
> In my understanding, a merge commit should display all files that had
> conflicts that needed resolving of any kind. Even if the resolution was
> simple (choose B), the decision to do so was non-trivial and had
> significant effect on the file (silently losing the bugfix).

We probably won't do that as it will be complex and slow to figure that out: the information on "conflicts" is not stored in the commit, hence it would be required to redo the merge (in memory) to understand which files had been affected by the merge resp. had conflicts. Anyway, if according to (a) the merge is reported, it should be sufficient to detect bad merges.

--
Best regards,
Marc Strapetz
=============
syntevo GmbH
http://www.syntevo.com
http://blog.syntevo.com


02/01/2012 18:20 - Norbert Nemec wrote:

> Hi there,
>
> one of our senior developers just desperately tried to find out why a
> bugfix that he once committed and merged into the master got lost on the
> way. Took us a long time to reconstruct:
>
> Same file modified on two branches:
> branch A: small bugfix in a few lines
> branch B: major refactoring of the file
> Merging A&B resulted in a conflict. The user doing the merge erraneously
> resolved the conflict by picking the version from branch B, eliminating
> the bugfix on branch A.
>
> Trying to identify the problem was rather tricky:
>
> Obviously, a merged file that is resolved by choosing the complete
> version from one parent is not considered significant part of the
> history of this file.
>
> a) the log-view for only the file in question does *not* include the
> critical merge commit that actually caused the problem.
>
> b) viewing the merge commit itself does *not* include this file.
>
> In my understanding, a merge commit should display all files that had
> conflicts that needed resolving of any kind. Even if the resolution was
> simple (choose B), the decision to do so was non-trivial and had
> significant effect on the file (silently losing the bugfix).
>
> I am not sure whether this issue can be resolved within SmartGIT or
> whether it is a more fundamental git issue. In the manpage for
> "git log", I found the paragraph about "History Simplification" which
> seems to relate to this issue. I don't know, though, in which way the
> log is obtained by SmartGIT and whether this could be tuned.
>
> Greetings,
> Norbert
>
>
> --
> Dr. Norbert Nemec
> Teamleader Software Development
>
> Tel +49-30-611035-1882
> [hidden email]
>
> KOMPLETE 8 ULTIMATE - the premium NI producer collection
> =>  http://www.native-instruments.com/komplete8
>
> TRAKTOR KONTROL S2 - the professional 2.1 DJ system
> =>  http://www.native-instruments.com/s2
>
> ->>>>>> NATIVE INSTRUMENTS - The Future of Sound <<<<<<-
>
> Registergericht: Amtsgericht Charlottenburg
> Registernummer: HRB 72458
> UST.-ID.-Nr. DE 20 374 7747
>
> Geschäftsführung: Daniel Haver (CEO), Mate Galic
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: How to find and analyze bad merges?

Andrew Herron
In reply to this post by Norbert Nemec
> b) viewing the merge commit itself does *not* include this file.
>
> In my understanding, a merge commit should display all files that had
> conflicts that needed resolving of any kind. Even if the resolution was
> simple (choose B), the decision to do so was non-trivial and had
> significant effect on the file (silently losing the bugfix).
>
>

I haven't tried to use SmartGit for merging as I'm used to using the command line - whenever I have a merge with conflicts the merge commit includes the list of conflicted files. Does SmartGit not do this? It might have provided some extra clues in this case.


[Non-text portions of this message have been removed]

Reply | Threaded
Open this post in threaded view
|

Re: How to find and analyze bad merges?

Norbert Nemec
In reply to this post by syntevo Support
Am 01.02.12 19:44, schrieb syntevo Support:

>  > a) the log-view for only the file in question does *not* include the
>  > critical merge commit that actually caused the problem.
>
> Current SmartGit logic is to include a merge commit, if the file's
> content is different compared to *all* of its parents. For the latest
> build I've now implemented the approach to include a merge commit if it
> is different to *any* of its parents. To enable, you need to have system
> property "smartgit.log.report-insignificant-merges" set to "true". For
> smartgit.git repository, resulting File Logs look reasonable, though Log
> might be cluttered now with many "insignificant" merge commits in case
> of many branches. Hence, feedback on this option is appreciated:

Excellent - looking forward to trying this out!

>  > b) viewing the merge commit itself does *not* include this file.
>  >
>  > In my understanding, a merge commit should display all files that had
>  > conflicts that needed resolving of any kind. Even if the resolution was
>  > simple (choose B), the decision to do so was non-trivial and had
>  > significant effect on the file (silently losing the bugfix).
>
> We probably won't do that as it will be complex and slow to figure that
> out: the information on "conflicts" is not stored in the commit, hence
> it would be required to redo the merge (in memory) to understand which
> files had been affected by the merge resp. had conflicts. Anyway, if
> according to (a) the merge is reported, it should be sufficient to
> detect bad merges.

Agreed. Anyway, perhaps there could be some feature to "analyze merge"?
When you have the suspicion that some merge is problematic, it is really
difficult to find out what the conflicts actually were and how they were
resolved. I have not clear idea yet how this feature should work, but
something certainly is needed.

Greetings,
Norbert


--
Dr. Norbert Nemec
Teamleader Software Development

Tel +49-30-611035-1882
[hidden email]

KOMPLETE 8 ULTIMATE - the premium NI producer collection
=>  http://www.native-instruments.com/komplete8

TRAKTOR KONTROL S2 - the professional 2.1 DJ system
=>  http://www.native-instruments.com/s2

->>>>>> NATIVE INSTRUMENTS - The Future of Sound <<<<<<-

Registergericht: Amtsgericht Charlottenburg
Registernummer: HRB 72458
UST.-ID.-Nr. DE 20 374 7747

Geschäftsführung: Daniel Haver (CEO), Mate Galic
Reply | Threaded
Open this post in threaded view
|

Re: How to find and analyze bad merges?

Norbert Nemec
In reply to this post by Andrew Herron
Am 01.02.12 22:35, schrieb Andrew Herron:

>  > b) viewing the merge commit itself does *not* include this file.
>  >
>  > In my understanding, a merge commit should display all files that had
>  > conflicts that needed resolving of any kind. Even if the resolution was
>  > simple (choose B), the decision to do so was non-trivial and had
>  > significant effect on the file (silently losing the bugfix).
>  >
>  >
>
> I haven't tried to use SmartGit for merging as I'm used to using the
> command line - whenever I have a merge with conflicts the merge commit
> includes the list of conflicted files. Does SmartGit not do this? It
> might have provided some extra clues in this case.

Indeed, even git itself is misleading here: A conflict that was resolved
by picking one of the two parent versions of the whole file is not
reported by doing "git show" on the merge commit.



--
Dr. Norbert Nemec
Teamleader Software Development

Tel +49-30-611035-1882
[hidden email]

KOMPLETE 8 ULTIMATE - the premium NI producer collection
=>  http://www.native-instruments.com/komplete8

TRAKTOR KONTROL S2 - the professional 2.1 DJ system
=>  http://www.native-instruments.com/s2

->>>>>> NATIVE INSTRUMENTS - The Future of Sound <<<<<<-

Registergericht: Amtsgericht Charlottenburg
Registernummer: HRB 72458
UST.-ID.-Nr. DE 20 374 7747

Geschäftsführung: Daniel Haver (CEO), Mate Galic
Reply | Threaded
Open this post in threaded view
|

Re: How to find and analyze bad merges?

syntevo Support
In reply to this post by Andrew Herron
> I haven't tried to use SmartGit for merging as I'm used to using the command
> line - whenever I have a merge with conflicts the merge commit includes the
> list of conflicted files. Does SmartGit not do this? It might have provided
> some extra clues in this case.

Are you referring to the commit message which lists the conflicted file names? On commit, SmartGit suggests this commit message, but as with command line Git the user may alter the message (and I guess usually does), so this won't be a reliable source.

--
Best regards,
Marc Strapetz
=============
syntevo GmbH
http://www.syntevo.com
http://blog.syntevo.com


02/01/2012 22:40 - Andrew Herron wrote:

> > b) viewing the merge commit itself does *not* include this file.
> >
> > In my understanding, a merge commit should display all files that had
> > conflicts that needed resolving of any kind. Even if the resolution was
> > simple (choose B), the decision to do so was non-trivial and had
> > significant effect on the file (silently losing the bugfix).
> >
> >
>
> I haven't tried to use SmartGit for merging as I'm used to using the command line
> - whenever I have a merge with conflicts the merge commit includes the list of
> conflicted files. Does SmartGit not do this? It might have provided some extra
> clues in this case.
>
>
> [Non-text portions of this message have been removed]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: How to find and analyze bad merges?

syntevo Support
In reply to this post by Norbert Nemec
> Agreed. Anyway, perhaps there could be some feature to "analyze merge"?
> When you have the suspicion that some merge is problematic, it is really
> difficult to find out what the conflicts actually were and how they were
> resolved. I have not clear idea yet how this feature should work, but
> something certainly is needed.

I think it should be able to figure out "interesting" resp. "critical" changes in the merge, given the resulting commit tree, the merge source trees and the merge base tree (it's this last one what makes things complicated). We'll probably need to do some dry-run merge and depending how fast this can be done, we may display results directly in the "Files" view when the Merge commit is selected. I've added this to the RFE list.

--
Best regards,
Marc Strapetz
=============
syntevo GmbH
http://www.syntevo.com
http://blog.syntevo.com


02/02/2012 08:50 - Norbert Nemec wrote:

> Am 01.02.12 19:44, schrieb syntevo Support:
> >  > a) the log-view for only the file in question does *not* include the
> >  > critical merge commit that actually caused the problem.
> >
> > Current SmartGit logic is to include a merge commit, if the file's
> > content is different compared to *all* of its parents. For the latest
> > build I've now implemented the approach to include a merge commit if it
> > is different to *any* of its parents. To enable, you need to have system
> > property "smartgit.log.report-insignificant-merges" set to "true". For
> > smartgit.git repository, resulting File Logs look reasonable, though Log
> > might be cluttered now with many "insignificant" merge commits in case
> > of many branches. Hence, feedback on this option is appreciated:
>
> Excellent - looking forward to trying this out!
>
> >  > b) viewing the merge commit itself does *not* include this file.
> >  >
> >  > In my understanding, a merge commit should display all files that had
> >  > conflicts that needed resolving of any kind. Even if the resolution was
> >  > simple (choose B), the decision to do so was non-trivial and had
> >  > significant effect on the file (silently losing the bugfix).
> >
> > We probably won't do that as it will be complex and slow to figure that
> > out: the information on "conflicts" is not stored in the commit, hence
> > it would be required to redo the merge (in memory) to understand which
> > files had been affected by the merge resp. had conflicts. Anyway, if
> > according to (a) the merge is reported, it should be sufficient to
> > detect bad merges.
>
> Agreed. Anyway, perhaps there could be some feature to "analyze merge"?
> When you have the suspicion that some merge is problematic, it is really
> difficult to find out what the conflicts actually were and how they were
> resolved. I have not clear idea yet how this feature should work, but
> something certainly is needed.
>
> Greetings,
> Norbert
>
>
> --
> Dr. Norbert Nemec
> Teamleader Software Development
>
> Tel +49-30-611035-1882
> [hidden email]
>
> KOMPLETE 8 ULTIMATE - the premium NI producer collection
> =>  http://www.native-instruments.com/komplete8
>
> TRAKTOR KONTROL S2 - the professional 2.1 DJ system
> =>  http://www.native-instruments.com/s2
>
> ->>>>>> NATIVE INSTRUMENTS - The Future of Sound <<<<<<-
>
> Registergericht: Amtsgericht Charlottenburg
> Registernummer: HRB 72458
> UST.-ID.-Nr. DE 20 374 7747
>
> Geschäftsführung: Daniel Haver (CEO), Mate Galic
>
Reply | Threaded
Open this post in threaded view
|

Re: How to find and analyze bad merges?

Norbert Nemec
Am 02.02.12 10:48, schrieb syntevo Support:
>  > Agreed. Anyway, perhaps there could be some feature to "analyze merge"?
>  > When you have the suspicion that some merge is problematic, it is really
>  > difficult to find out what the conflicts actually were and how they were
>  > resolved. I have not clear idea yet how this feature should work, but
>  > something certainly is needed.
>
> I think it should be able to figure out "interesting" resp. "critical"
> changes in the merge,

Indeed - "critical" would be anything where auto-merge failed *or* the
user committed anything different from the auto-merge suggestion.

"interesting" would actually be anything where auto-merge was needed at
all (considering that even a successful auto-merge might have messed up).

> given the resulting commit tree, the merge source
> trees and the merge base tree (it's this last one what makes things
> complicated).

Just wondering: is there any significant distinction between "merge
source" and "merge base" apart from the order in which the parents are
named in the merge commit?

> We'll probably need to do some dry-run merge and depending
> how fast this can be done, we may display results directly in the
> "Files" view when the Merge commit is selected. I've added this to the
> RFE list.

Is there any way to perform a merge without checking out one of the
parents? I fear, this is something GIT would have to offer: perform an
auto-merge between the parents of a commit and diff the result against
the recorded merge without touching the working tree.

Greetings,
Norbert

--
Dr. Norbert Nemec
Teamleader Software Development

Tel +49-30-611035-1882
[hidden email]

KOMPLETE 8 ULTIMATE - the premium NI producer collection
=>  http://www.native-instruments.com/komplete8

TRAKTOR KONTROL S2 - the professional 2.1 DJ system
=>  http://www.native-instruments.com/s2

->>>>>> NATIVE INSTRUMENTS - The Future of Sound <<<<<<-

Registergericht: Amtsgericht Charlottenburg
Registernummer: HRB 72458
UST.-ID.-Nr. DE 20 374 7747

Geschäftsführung: Daniel Haver (CEO), Mate Galic
Reply | Threaded
Open this post in threaded view
|

Re: How to find and analyze bad merges?

syntevo Support
> Just wondering: is there any significant distinction between "merge
> source" and "merge base" apart from the order in which the parents are
> named in the merge commit?

With "merge base" I'm referring to the common commit of both merge sources. This will be necessary to understand what happened for the merge. The critical part here is the rename-tracking which makes Git good at merging, but hard to reconstruct the merge.

> Is there any way to perform a merge without checking out one of the
> parents? I fear, this is something GIT would have to offer: perform an
> auto-merge between the parents of a commit and diff the result against
> the recorded merge without touching the working tree.

I hope to find some reasonable API in jgit which won't require a working tree.

--
Best regards,
Marc Strapetz
=============
syntevo GmbH
http://www.syntevo.com
http://blog.syntevo.com


02/02/2012 11:10 - Norbert Nemec wrote:

> Am 02.02.12 10:48, schrieb syntevo Support:
> >  > Agreed. Anyway, perhaps there could be some feature to "analyze merge"?
> >  > When you have the suspicion that some merge is problematic, it is really
> >  > difficult to find out what the conflicts actually were and how they were
> >  > resolved. I have not clear idea yet how this feature should work, but
> >  > something certainly is needed.
> >
> > I think it should be able to figure out "interesting" resp. "critical"
> > changes in the merge,
>
> Indeed - "critical" would be anything where auto-merge failed *or* the
> user committed anything different from the auto-merge suggestion.
>
> "interesting" would actually be anything where auto-merge was needed at
> all (considering that even a successful auto-merge might have messed up).
>
> > given the resulting commit tree, the merge source
> > trees and the merge base tree (it's this last one what makes things
> > complicated).
>
> Just wondering: is there any significant distinction between "merge
> source" and "merge base" apart from the order in which the parents are
> named in the merge commit?
>
> > We'll probably need to do some dry-run merge and depending
> > how fast this can be done, we may display results directly in the
> > "Files" view when the Merge commit is selected. I've added this to the
> > RFE list.
>
> Is there any way to perform a merge without checking out one of the
> parents? I fear, this is something GIT would have to offer: perform an
> auto-merge between the parents of a commit and diff the result against
> the recorded merge without touching the working tree.
>
> Greetings,
> Norbert
>
> --
> Dr. Norbert Nemec
> Teamleader Software Development
>
> Tel +49-30-611035-1882
> [hidden email]
>
> KOMPLETE 8 ULTIMATE - the premium NI producer collection
> =>  http://www.native-instruments.com/komplete8
>
> TRAKTOR KONTROL S2 - the professional 2.1 DJ system
> =>  http://www.native-instruments.com/s2
>
> ->>>>>> NATIVE INSTRUMENTS - The Future of Sound <<<<<<-
>
> Registergericht: Amtsgericht Charlottenburg
> Registernummer: HRB 72458
> UST.-ID.-Nr. DE 20 374 7747
>
> Geschäftsführung: Daniel Haver (CEO), Mate Galic
>
Reply | Threaded
Open this post in threaded view
|

Re: How to find and analyze bad merges?

fmazerolle
In reply to this post by Norbert Nemec

Just adding my 2 cents:

I think this could have been a good opportunity to use the git bisect command ... This way you would have been able to find where the bug was was broken.

Reply | Threaded
Open this post in threaded view
|

Re: How to find and analyze bad merges?

Norbert Nemec
My concern was not so much finding the point of breaking. In fact, there
was just a small number of commits to look throug.

The real issue was that both, the log view as well as the commit view,
give no clue that the merge commit affect the file at all.

My medium-experienced colleague was completely lost at that. I myself
realized quickly that this merge-commit must have been the problem but
still had to look at it very hard to understand the situation.




Am 02.02.12 14:40, schrieb fmazerolle_it:
>
> Just adding my 2 cents:
>
> I think this could have been a good opportunity to use the git bisect
> command ... This way you would have been able to find where the bug was
> was broken.
>
>

--
Dr. Norbert Nemec
Teamleader Software Development

Tel +49-30-611035-1882
[hidden email]

KOMPLETE 8 ULTIMATE - the premium NI producer collection
=>  http://www.native-instruments.com/komplete8

TRAKTOR KONTROL S2 - the professional 2.1 DJ system
=>  http://www.native-instruments.com/s2

->>>>>> NATIVE INSTRUMENTS - The Future of Sound <<<<<<-

Registergericht: Amtsgericht Charlottenburg
Registernummer: HRB 72458
UST.-ID.-Nr. DE 20 374 7747

Geschäftsführung: Daniel Haver (CEO), Mate Galic


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/smartgit/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/smartgit/join
    (Yahoo! ID required)

<*> To change settings via email:
    [hidden email]
    [hidden email]

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/