public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp•fr>
To: "Kyle J. McKay" <mackyle@gmail•com>
Cc: git@vger•kernel.org, Junio C Hamano <gitster@pobox•com>,
	Ramkumar Ramachandra <artagnon@gmail•com>,
	Eric Sunshine <sunshine@sunshineco•com>
Subject: Re: [PATCH 1/3] rebase: avoid non-function use of "return" on FreeBSD
Date: Mon, 14 Apr 2014 10:24:38 +0200	[thread overview]
Message-ID: <vpq8ur85neh.fsf@anie.imag.fr> (raw)
In-Reply-To: <32c0335e91b9658a9cca007f6851280@74d39fa044aa309eaea14b9f57fe79c> (Kyle J. McKay's message of "Sat, 12 Apr 2014 19:45:12 -0700")

"Kyle J. McKay" <mackyle@gmail•com> writes:

> So I suggest that in the interest of fixing rebase on FreeBSD in an  
> expeditious fashion, patches 1/3 and 2/3 get picked up (see note  
> below) now and that the follow-on patch below, after being enhanced to  
> pass all tests, be submitted separately at some future point.

Seems a good plan to me.

> Needs-Signed-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp•fr>

Signed-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp•fr>

> From: Matthieu Moy <Matthieu.Moy@grenoble-inp•fr>
> Subject: [PATCH 4/3] rebase: stop using . within function
> 
> Move the whole run_specific_rebase_internal function to
> git-rebase--$type.
> 
> The .-ed script defines the complete function, and then the
> function is used from the toplevel script.
> 
> The goal is to avoid using tricky features that may trigger
> bugs on some shells.
> 
> The result is simpler, just using the basic pattern:
> 
>     1. use '. file' to import a set of functions
>     2. then use these functions
> 
> Needs-Signed-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp•fr>
> ---
>  git-rebase--am.sh          |  3 +--
>  git-rebase--interactive.sh |  3 +--
>  git-rebase--merge.sh       |  3 +--
>  git-rebase.sh              | 40 +++++++++++++++++++++-------------------
>  4 files changed, 24 insertions(+), 25 deletions(-)
> 
> diff --git a/git-rebase--am.sh b/git-rebase--am.sh
> index 2d3f6d55..b48b3e90 100644
> --- a/git-rebase--am.sh
> +++ b/git-rebase--am.sh
> @@ -4,7 +4,7 @@
>  # Copyright (c) 2010 Junio C Hamano.
>  #
>  
> -git_rebase__am() {
> +run_specific_rebase_infile() {
>  	case "$action" in
>  	continue)
>  		git am --resolved --resolvemsg="$resolvemsg" &&
> @@ -75,4 +75,3 @@ git_rebase__am() {
>  
>  	move_to_original_branch
>  }
> -git_rebase__am
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index 42164f11..a7670eb0 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -810,7 +810,7 @@ add_exec_commands () {
>  	mv "$1.new" "$1"
>  }
>  
> -git_rebase__interactive() {
> +run_specific_rebase_infile() {
>  	case "$action" in
>  	continue)
>  		# do we have anything to commit?
> @@ -1044,4 +1044,3 @@ EOF
>  	git update-ref ORIG_HEAD $orig_head
>  	do_rest
>  }
> -git_rebase__interactive
> diff --git a/git-rebase--merge.sh b/git-rebase--merge.sh
> index b5f05bf5..9550e656 100644
> --- a/git-rebase--merge.sh
> +++ b/git-rebase--merge.sh
> @@ -101,7 +101,7 @@ finish_rb_merge () {
>  	say All done.
>  }
>  
> -git_rebase__merge() {
> +run_specific_rebase_infile() {
>  	case "$action" in
>  	continue)
>  		read_state
> @@ -153,4 +153,3 @@ git_rebase__merge() {
>  
>  	finish_rb_merge
>  }
> -git_rebase__merge
> diff --git a/git-rebase.sh b/git-rebase.sh
> index 07e2bd48..9e105626 100755
> --- a/git-rebase.sh
> +++ b/git-rebase.sh
> @@ -175,7 +175,7 @@ run_specific_rebase () {
>  		export GIT_EDITOR
>  		autosquash=
>  	fi
> -	. git-rebase--$type
> +	run_specific_rebase_infile
>  	ret=$?
>  	if test $ret -eq 0
>  	then
> @@ -353,6 +353,26 @@ then
>  	die "$(gettext "The --edit-todo action can only be used during interactive rebase.")"
>  fi
>  
> +if test -n "$rebase_root" && test -z "$onto"
> +then
> +	test -z "$interactive_rebase" && interactive_rebase=implied
> +fi
> +
> +if test -n "$interactive_rebase"
> +then
> +	type=interactive
> +	state_dir="$merge_dir"
> +elif test -n "$do_merge"
> +then
> +	type=merge
> +	state_dir="$merge_dir"
> +else
> +	type=am
> +	state_dir="$apply_dir"
> +fi
> +
> +. git-rebase--$type
> +
>  case "$action" in
>  continue)
>  	# Sanity check
> @@ -407,24 +427,6 @@ and run me again.  I am stopping in case you still have something
>  valuable there.')"
>  fi
>  
> -if test -n "$rebase_root" && test -z "$onto"
> -then
> -	test -z "$interactive_rebase" && interactive_rebase=implied
> -fi
> -
> -if test -n "$interactive_rebase"
> -then
> -	type=interactive
> -	state_dir="$merge_dir"
> -elif test -n "$do_merge"
> -then
> -	type=merge
> -	state_dir="$merge_dir"
> -else
> -	type=am
> -	state_dir="$apply_dir"
> -fi
> -
>  if test -z "$rebase_root"
>  then
>  	case "$#" in
> -- 
> 1.8.5

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

  reply	other threads:[~2014-04-14  8:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-11  8:28 [PATCH 0/3] Fix support for FreeBSD's /bin/sh Kyle J. McKay
2014-04-11  8:28 ` [PATCH 1/3] rebase: avoid non-function use of "return" on FreeBSD Kyle J. McKay
2014-04-11  8:48   ` Matthieu Moy
2014-04-11 14:29     ` Kyle J. McKay
2014-04-11 17:30       ` Matthieu Moy
2014-04-11 23:08         ` Kyle J. McKay
2014-04-12 17:07           ` Matthieu Moy
2014-04-13  2:45             ` Kyle J. McKay
2014-04-14  8:24               ` Matthieu Moy [this message]
2014-04-14 22:28                 ` Junio C Hamano
2014-04-14 22:51   ` Junio C Hamano
2014-04-16  4:32     ` Kyle J. McKay
2014-04-16 16:47       ` Junio C Hamano
2014-04-16 18:11         ` Junio C Hamano
2014-04-16 18:23           ` Junio C Hamano
2014-04-17  0:41           ` Kyle J. McKay
2014-04-17 17:15             ` Junio C Hamano
2014-04-18  0:26               ` Kyle J. McKay
2014-04-11  8:28 ` [PATCH 2/3] Revert "rebase: fix run_specific_rebase's use of "return" on FreeBSD" Kyle J. McKay
2014-04-11  8:28 ` [PATCH 3/3] test: fix t5560 on FreeBSD Kyle J. McKay
2014-04-11 20:52   ` Junio C Hamano

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=vpq8ur85neh.fsf@anie.imag.fr \
    --to=matthieu.moy@grenoble-inp$(echo .)fr \
    --cc=artagnon@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=mackyle@gmail$(echo .)com \
    --cc=sunshine@sunshineco$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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