summaryrefslogtreecommitdiff
path: root/git-rebase--merge.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-04-21 10:42:45 -0700
committerJunio C Hamano <gitster@pobox.com>2014-04-21 10:42:46 -0700
commit0b17b4331087224883878e49342037bf69717b62 (patch)
tree36812666a6ea99efc7455c7437a5e560f3803d46 /git-rebase--merge.sh
parent0e6e1a5fbdd3143b74bf45f009bb4e850bdc785a (diff)
parent8cd65967fe0084574fcee278a5f9ff3d14047c4f (diff)
downloadgit-0b17b4331087224883878e49342037bf69717b62.tar.gz
Merge branch 'km/avoid-non-function-return-in-rebase'
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
Diffstat (limited to 'git-rebase--merge.sh')
-rw-r--r--git-rebase--merge.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/git-rebase--merge.sh b/git-rebase--merge.sh
index 5381857c59..71429fd743 100644
--- a/git-rebase--merge.sh
+++ b/git-rebase--merge.sh
@@ -101,6 +101,17 @@ finish_rb_merge () {
say All done.
}
+# 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__merge () {
+
case "$action" in
continue)
read_state
@@ -151,3 +162,7 @@ do
done
finish_rb_merge
+
+}
+# ... and then we call the whole thing.
+git_rebase__merge