mergetool: don't require a work tree for --tool-help
[gitweb.git] / git-rebase--am.sh
index df46f4ca9629253238e94ae31ae26c77b452dde3..ca20e1e66fbda7c27a8a4cfff03ecf02841e1002 100644 (file)
@@ -4,6 +4,17 @@
 # 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" \
@@ -75,3 +86,7 @@ then
 fi
 
 move_to_original_branch
+
+}
+# ... and then we call the whole thing.
+git_rebase__am