Skip to content

Commit 99855dd

Browse files
moygitster
authored andcommitted
rebase: fix run_specific_rebase's use of "return" on FreeBSD
Since a1549e1, git-rebase--am.sh uses the shell's "return" statement, to mean "return from the current file inclusion", which is POSIXly correct, but badly interpreted on FreeBSD, which returns from the current function, hence skips the finish_rebase statement that follows the file inclusion. Make the use of "return" portable by using the file inclusion as the last statement of a function. Reported-by: Christoph Mallon <[email protected]> Signed-off-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 15d4bf2 commit 99855dd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

git-rebase.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,22 @@ move_to_original_branch () {
143143
esac
144144
}
145145

146-
run_specific_rebase () {
146+
run_specific_rebase_internal () {
147147
if [ "$interactive_rebase" = implied ]; then
148148
GIT_EDITOR=:
149149
export GIT_EDITOR
150150
autosquash=
151151
fi
152+
# On FreeBSD, the shell's "return" returns from the current
153+
# function, not from the current file inclusion.
154+
# run_specific_rebase_internal has the file inclusion as a
155+
# last statement, so POSIX and FreeBSD's return will do the
156+
# same thing.
152157
. git-rebase--$type
158+
}
159+
160+
run_specific_rebase () {
161+
run_specific_rebase_internal
153162
ret=$?
154163
if test $ret -eq 0
155164
then

0 commit comments

Comments
 (0)