git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 4/5] Head reduction before selecting merge strategy

From
Jakub Narebski <jnareb@gmail.com>
Date
Apr 25, 2008, 10:31 UTC
Message-ID
<m3prsep6oy.fsf@localhost.localdomain>
In-Reply-To
<402c10cd0804232252g43606767r10344ebbb2a44af9@mail.gmail.com>
"Sverre Hvammen Johansen" <hvammen@gmail.com> writes:
> See the documentation for an explanation of this feature.
I think I get the idea now.

You want to generalize fast-forward merge, or what's equivalent make fast-formard merge to be special case of head reduction. This should be written both in commit message and in documentation. Do I understand your goal correctly?

With head reduction comes three things:
 * the merge strategy used
 * recorded parents
 * generated merge commit message
The simplest way would be to use reduced head for all three things,
I think.
But I also think that this commit in series is the most controversial
one; is it realy needed for other commits?  I would put it then as the
last commit in series...
 
Show 7 quoted lines
> +If more than one commit are specified on the command line, git will
> +try to reduce the number of commits used (reduced parents) by
> +eliminating commits than can be reached from other commits.  The
> +commit message will reflect the commits specified on the command line
> +but the merge strategy will be selected based on the reduced parents
> +including `HEAD`.  The reduced parents are the parents recorded in the
> +merge commit object.

Is it a correct solution, to use provided (specified) heads for generation of merge commit message, but use reduced heads for selecting merge strategy _and_ also as parents recorded in merge commits? Perhaps it is; but IMHO you should have written it in the commit message, and defend this decision in commit message.

Show 14 quoted lines
> +
> +The following shows master and three topic branches.  topicB is based
> +on topicA, topicA is previously branched off from master, and topicC
> +is based on the tip of the master branch:
> +
> +------------
> +                    o---o---o  topicB
> +                   /
> +          o---o---o  topicA
> +         /
> +    o---o---o---o---o---o  master
> +                         \
> +                          o---o  topicC
> +------------

I think I would start with simpler example without 'topicC', of reduction of octopus to two-parent ordinary merge.

Show 9 quoted lines
> diff --git a/git-merge.sh b/git-merge.sh
> index 7c34b6c..7c70c56 100755
> --- a/git-merge.sh
> +++ b/git-merge.sh
> @@ -337,11 +337,16 @@ set x $remoteheads ; shift
> 
>  find_reduced_parents "$@"
> 
> -actual_parents=$(git rev-parse "$@")
This was introduced by some of your earlier commits, isn't it?
[...]
-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Sverre Hvammen JohansenNext: Sverre Hvammen Johansen
Message 2 of 3 in “Head reduction before selecting merge strategy”
  1. 4/5 Head reduction before selecting merge strategySverre Hvammen Johansen, Apr 24, 2008
  2. Jakub NarebskiApr 25, 2008
  3. Sverre Hvammen JohansenMay 4, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.