OSDN Git Service

Merge branch 'km/avoid-non-function-return-in-rebase'
authorJunio C Hamano <gitster@pobox.com>
Mon, 21 Apr 2014 17:42:45 +0000 (10:42 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 21 Apr 2014 17:42:46 +0000 (10:42 -0700)
Work around /bin/sh that does not like "return" at the top-level
of a file that is dot-sourced from inside a function definition.

* km/avoid-non-function-return-in-rebase:
  Revert "rebase: fix run_specific_rebase's use of "return" on FreeBSD"
  rebase: avoid non-function use of "return" on FreeBSD

1  2 
git-rebase--am.sh
git-rebase--interactive.sh
git-rebase--merge.sh
git-rebase.sh

@@@ -4,10 -4,20 +4,21 @@@
  # Copyright (c) 2010 Junio C Hamano.
  #
  
+ # The whole contents of this file is run by dot-sourcing it from
+ # inside a shell function.  It used to be that "return"s we see
+ # below were not inside any function, and expected to return
+ # to the function that dot-sourced us.
+ #
+ # However, FreeBSD /bin/sh misbehaves on such a construct and
+ # continues to run the statements that follow such a "return".
+ # As a work-around, we introduce an extra layer of a function
+ # here, and immediately call it after defining it.
+ git_rebase__am () {
  case "$action" in
  continue)
 -      git am --resolved --resolvemsg="$resolvemsg" &&
 +      git am --resolved --resolvemsg="$resolvemsg" \
 +              ${gpg_sign_opt:+"$gpg_sign_opt"} &&
        move_to_original_branch
        return
        ;;
Simple merge
Simple merge
diff --cc git-rebase.sh
Simple merge