git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Sverre Hvammen Johansen" <hvammen@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC/PATCH 2/4] Restructuring git-merge.sh
Date: Wed, 26 Mar 2008 09:17:46 -0700	[thread overview]
Message-ID: <7vr6dxe9xx.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 402c10cd0803252056n122cae6cv1a6f4e46a5fb5096@mail.gmail.com

"Sverre Hvammen Johansen" <hvammen@gmail.com> writes:

> for preparation of new feature:

Full sentence, please?

>
>    Head reduction before selecting merge strategy
>
> Signed-off-by: Sverre Hvammen Johansen <hvammen@gmail.com>
> ---
>  git-merge.sh |  166 ++++++++++++++++++++++++++++++----------------------------
>  1 files changed, 85 insertions(+), 81 deletions(-)
>
> diff --git a/git-merge.sh b/git-merge.sh
> index 17f40f2..2acd2cc 100755
> --- a/git-merge.sh
> +++ b/git-merge.sh
> @@ -207,6 +207,29 @@ parse_config () {
>         args_left=$#
>  }
>
> +# Find real parents
> +# Set the following variables as followd:
> +#   real_parents: The parents specified on the command line
> +#   common:       All common ancestors or not_queried
> +#   ff_head:      Fast forward of head

"Fast forward of head"?  Puzzled, and sorry I cannot offer a better
rewrite for this one as I do not quite get what you are trying to say
here.

> +find_real_parents () {
> +       real_parents=$(git rev-parse "$@")
> +       real_parents=${real_parents#$LF}

What is this "#$LF" for?  rev-parse begins its output with an empty line
and you want to strip it?

> +       if test $# = 1
> +       then
> +               common=$(git merge-base --all $head "$@")
> +               if test "$common" = $head
> +               then
> +                       ff_head=$1
> +               else
> +                       ff_head=$head
> +               fi

So for a single-remote merge, merge-base is run and common is set.

> @@ -339,87 +364,66 @@ do
> +if true
> +then

This caught my attention before looking at 3/4 ;-).

> -       # An octopus.  If we can reach all the remote we are up to date.
> -       up_to_date=t
> -       for remote
> -       do
> -               common_one=$(git merge-base --all $head $remote)
> -               if test "$common_one" != "$remote"
>                 then
> -                       up_to_date=f
> -                       break
>                 fi
> -       done
> -       if test "$up_to_date" = t
> -       then
> -               finish_up_to_date "Already up-to-date. Yeeah!"
>                 exit 0
>         fi

This optimization seems to have been lost, even though it was supposed to
be just code restructuring.

> +fi
> +
> +case "$real_parents" in
> +?*"$LF"?*)
> +       # We have more than one parent
> +       common=$(git show-branch --merge-base $head $real_parents)
>         ;;
> +*)
> +       # We have exactly one parent
> +       test "$common" != not_queried || common=$(git merge-base --all
> $head $real_parents)

How can "not_queried" be possible here?

      parent reply	other threads:[~2008-03-26 16:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-26  3:56 [RFC/PATCH 2/4] Restructuring git-merge.sh Sverre Hvammen Johansen
2008-03-26 12:40 ` Jakub Narebski
2008-03-26 16:17 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vr6dxe9xx.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=hvammen@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).