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

Re: [PATCH 1/3] rebase: avoid non-function use of "return" on FreeBSD

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Apr 14, 2014, 08:24 UTC
Message-ID
<vpq8ur85neh.fsf@anie.imag.fr>
In-Reply-To
<32c0335e91b9658a9cca007f6851280@74d39fa044aa309eaea14b9f57fe79c>
"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>
Show 146 quoted lines
> 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/
Previous: Kyle J. McKayNext: Junio C Hamano
Message 9 of 21 in “Fix support for FreeBSD's /bin/sh”
  1. 0/3 Fix support for FreeBSD's /bin/shKyle J. McKay, Apr 11, 2014
  2. 1/3 rebase: avoid non-function use of "return" on FreeBSDKyle J. McKay, Apr 11, 2014
  3. Matthieu MoyApr 11, 2014
  4. Kyle J. McKayApr 11, 2014
  5. Matthieu MoyApr 11, 2014
  6. Kyle J. McKayApr 11, 2014
  7. Matthieu MoyApr 12, 2014
  8. Kyle J. McKayApr 13, 2014
  9. Matthieu MoyApr 14, 2014
  10. Junio C HamanoApr 14, 2014
  11. Junio C HamanoApr 14, 2014
  12. Kyle J. McKayApr 16, 2014
  13. Junio C HamanoApr 16, 2014
  14. Junio C HamanoApr 16, 2014
  15. Junio C HamanoApr 16, 2014
  16. Kyle J. McKayApr 17, 2014
  17. Junio C HamanoApr 17, 2014
  18. Kyle J. McKayApr 18, 2014
  19. 2/3 Revert "rebase: fix run_specific_rebase's use of "return" on FreeBSD"Kyle J. McKay, Apr 11, 2014
  20. 3/3 test: fix t5560 on FreeBSDKyle J. McKay, Apr 11, 2014
  21. Junio C HamanoApr 11, 2014

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.