summaryrefslogtreecommitdiff
path: root/git-rebase--am.sh
diff options
context:
space:
mode:
Diffstat (limited to 'git-rebase--am.sh')
-rw-r--r--git-rebase--am.sh18
1 files changed, 17 insertions, 1 deletions
diff --git a/git-rebase--am.sh b/git-rebase--am.sh
index 34e3102..1cdc139 100644
--- a/git-rebase--am.sh
+++ b/git-rebase--am.sh
@@ -1,8 +1,20 @@
-#!/bin/sh
+# This shell script fragment is sourced by git-rebase to implement
+# its default, fast, patch-based, non-interactive mode.
#
# 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" &&
@@ -72,3 +84,7 @@ then
fi
move_to_original_branch
+
+}
+# ... and then we call the whole thing.
+git_rebase__am