mirror of
https://github.com/git/git.git
synced 2025-03-15 14:11:54 +00:00
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
This commit is contained in:
commit
0b17b43310
@ -4,6 +4,17 @@
|
|||||||
# Copyright (c) 2010 Junio C Hamano.
|
# 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
|
case "$action" in
|
||||||
continue)
|
continue)
|
||||||
git am --resolved --resolvemsg="$resolvemsg" \
|
git am --resolved --resolvemsg="$resolvemsg" \
|
||||||
@ -75,3 +86,7 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
move_to_original_branch
|
move_to_original_branch
|
||||||
|
|
||||||
|
}
|
||||||
|
# ... and then we call the whole thing.
|
||||||
|
git_rebase__am
|
||||||
|
@ -820,6 +820,17 @@ add_exec_commands () {
|
|||||||
mv "$1.new" "$1"
|
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
|
case "$action" in
|
||||||
continue)
|
continue)
|
||||||
# do we have anything to commit?
|
# do we have anything to commit?
|
||||||
@ -1055,3 +1066,7 @@ GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $onto_name"
|
|||||||
output git checkout $onto || die_abort "could not detach HEAD"
|
output git checkout $onto || die_abort "could not detach HEAD"
|
||||||
git update-ref ORIG_HEAD $orig_head
|
git update-ref ORIG_HEAD $orig_head
|
||||||
do_rest
|
do_rest
|
||||||
|
|
||||||
|
}
|
||||||
|
# ... and then we call the whole thing.
|
||||||
|
git_rebase__interactive
|
||||||
|
@ -101,6 +101,17 @@ finish_rb_merge () {
|
|||||||
say All done.
|
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
|
case "$action" in
|
||||||
continue)
|
continue)
|
||||||
read_state
|
read_state
|
||||||
@ -151,3 +162,7 @@ do
|
|||||||
done
|
done
|
||||||
|
|
||||||
finish_rb_merge
|
finish_rb_merge
|
||||||
|
|
||||||
|
}
|
||||||
|
# ... and then we call the whole thing.
|
||||||
|
git_rebase__merge
|
||||||
|
@ -175,22 +175,13 @@ You can run "git stash pop" or "git stash drop" at any time.
|
|||||||
rm -rf "$state_dir"
|
rm -rf "$state_dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
run_specific_rebase_internal () {
|
run_specific_rebase () {
|
||||||
if [ "$interactive_rebase" = implied ]; then
|
if [ "$interactive_rebase" = implied ]; then
|
||||||
GIT_EDITOR=:
|
GIT_EDITOR=:
|
||||||
export GIT_EDITOR
|
export GIT_EDITOR
|
||||||
autosquash=
|
autosquash=
|
||||||
fi
|
fi
|
||||||
# On FreeBSD, the shell's "return" returns from the current
|
|
||||||
# function, not from the current file inclusion.
|
|
||||||
# run_specific_rebase_internal has the file inclusion as a
|
|
||||||
# last statement, so POSIX and FreeBSD's return will do the
|
|
||||||
# same thing.
|
|
||||||
. git-rebase--$type
|
. git-rebase--$type
|
||||||
}
|
|
||||||
|
|
||||||
run_specific_rebase () {
|
|
||||||
run_specific_rebase_internal
|
|
||||||
ret=$?
|
ret=$?
|
||||||
if test $ret -eq 0
|
if test $ret -eq 0
|
||||||
then
|
then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user