summaryrefslogtreecommitdiff
path: root/git-rebase--interactive.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-05-08 10:01:06 -0700
committerJunio C Hamano <gitster@pobox.com>2014-05-08 10:01:06 -0700
commite79fcfcd3f95b1a6b4df11b889c69a80864354b0 (patch)
tree3edaf8c525e6ef917a844e39384c4df02d75888a /git-rebase--interactive.sh
parente230cd861bc1c1cbb0743800d6ade853898a38db (diff)
parent8cd65967fe0084574fcee278a5f9ff3d14047c4f (diff)
downloadgit-e79fcfcd3f95b1a6b4df11b889c69a80864354b0.tar.gz
Merge branch 'km/avoid-non-function-return-in-rebase' into maint
"git rebase" used a POSIX shell construct FreeBSD /bin/sh does not work well with. * 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
Diffstat (limited to 'git-rebase--interactive.sh')
-rw-r--r--git-rebase--interactive.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 43631b4723..9e1dd1eb5a 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -810,6 +810,17 @@ add_exec_commands () {
mv "$1.new" "$1"
}
+# 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__interactive () {
+
case "$action" in
continue)
# do we have anything to commit?
@@ -1042,3 +1053,7 @@ GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $onto_name"
output git checkout $onto || die_abort "could not detach HEAD"
git update-ref ORIG_HEAD $orig_head
do_rest
+
+}
+# ... and then we call the whole thing.
+git_rebase__interactive