Why does git merge have so much trouble with Fedora package branches?

Neil Horman nhorman at redhat.com
Thu Nov 10 12:05:59 UTC 2011


On Wed, Nov 09, 2011 at 05:46:57PM -0800, Adam Williamson wrote:
> I'm currently going through and bumping several packages whose Rawhide
> builds have got behind their F16 builds.
> 
> I've come across several packages where git merge hit 'conflicts' for no
> readily apparently reason in this case.
> 
> Take the current state of gnome-power-manager. Master is at:
> 
> commit dfd0f074a7d41d355da28180eae1bda5dc2bba66
> Author: Richard Hughes <richard at hughsie.com>
> Date:   Mon Sep 26 16:58:28 2011 +0100
> 
>     New upstream version.
> 
> f16 is at:
> 
> commit b0b31219d2cfdffa815659a8aad78509b65c412a
> Author: Richard Hughes <richard at hughsie.com>
> Date:   Mon Oct 17 11:34:50 2011 +0100
> 
>     New upstream version.
> 
> which is just a single commit ahead of the master branch. The git diff
> is incredibly trivial:
> 
> [adamw at adam gnome-power-manager (f16)]$ git diff dfd0f074a7d41d355da28180eae1bda5dc2bba66
> diff --git a/.gitignore b/.gitignore
> index 7cf4a61..b9cba18 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -15,3 +15,4 @@ gnome-power-manager-2.31.4.tar.bz2
>  /gnome-power-manager-3.1.90.tar.xz
>  /gnome-power-manager-3.1.92.tar.xz
>  /gnome-power-manager-3.2.0.tar.xz
> +/gnome-power-manager-3.2.1.tar.xz
> diff --git a/gnome-power-manager.spec b/gnome-power-manager.spec
> index cba83e2..e5a512f 100644
> --- a/gnome-power-manager.spec
> +++ b/gnome-power-manager.spec
> @@ -1,6 +1,6 @@
>  Summary: GNOME power management service
>  Name: gnome-power-manager
> -Version: 3.2.0
> +Version: 3.2.1
>  Release: 1%{?dist}
>  License: GPLv2+ and GFDL
>  Group: Applications/System
> @@ -75,6 +75,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null
>  %{_mandir}/man1/*.1.gz
>  
>  %changelog
> +* Mon Oct 17 2011 Richard Hughes <rhughes at redhat.com> - 3.2.1-1
> +- New upstream version.
> +
>  * Mon Sep 26 2011 Richard Hughes <rhughes at redhat.com> - 3.2.0-1
>  - New upstream version.
>  
> diff --git a/sources b/sources
> index 81e4f0f..2d18e7f 100644
> --- a/sources
> +++ b/sources
> @@ -1 +1 @@
> -4dafea2ae923599685f91de033f23888  gnome-power-manager-3.2.0.tar.xz
> +8e8a3759e0805041342c1f49471ee4ed  gnome-power-manager-3.2.1.tar.xz
> 
> 
> But if you try and do a merge:
> 
> [adamw at adam gnome-power-manager (master)]$ git merge --no-ff b0b31219d2cfdffa815659a8aad78509b65c412a
> Auto-merging sources
> CONFLICT (content): Merge conflict in sources
> Auto-merging gnome-power-manager.spec
> CONFLICT (content): Merge conflict in gnome-power-manager.spec
> Auto-merging .gitignore
> CONFLICT (content): Merge conflict in .gitignore
> Automatic merge failed; fix conflicts and then commit the result.
> 
> why the conflict? Why can it not merge this incredibly simple version
> bump? I guess I'm just missing something about how git works, but I
> can't really see why this causes a problem.
> 
> It's rather infuriating to have to go in and 'fix' a bunch of
> 'conflicts' which are not conflicts at all, but just the changes you
> wanted to merge with a bunch of silly >>>> and <<<< around them.
> -- 
> Adam Williamson
> Fedora QA Community Monkey
> IRC: adamw | Twitter: AdamW_Fedora | identi.ca: adamwfedora
> http://www.happyassassin.net
> 
> -- 
> devel mailing list
> devel at lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/devel

You're getting problems I think because a merge joins two branches together by
merging the changes from both since the most recent merge base (as found by git
merge-branch A B)

If you run git merge-branch dfd0f074a7d41d355da28180eae1bda5dc2bba66 f16, you
actually come up with quite a number of commits that need to be merged.  Several
of those commits are probably in the master and f16 branches under separate
commit ids.  Being separate commit ids, but having the same diff changes,
results in git tossing them out as conflicts, even though the result of taking
either change would be the same.

Neil



More information about the devel mailing list