Merge branch 'pw/no-editor-in-rebase-i-implicit'
When GIT_SEQUENCE_EDITOR is set, the command was incorrectly started when modes of "git rebase" that implicitly uses the machinery for the interactive rebase are run, which has been corrected. * pw/no-editor-in-rebase-i-implicit: implicit interactive rebase: don't run sequence editormaint
commit
69dd6e5737
|
@ -355,7 +355,8 @@ static int run_specific_rebase(struct rebase_options *opts)
|
||||||
argv_array_pushf(&child.env_array, "GIT_CHERRY_PICK_HELP=%s",
|
argv_array_pushf(&child.env_array, "GIT_CHERRY_PICK_HELP=%s",
|
||||||
resolvemsg);
|
resolvemsg);
|
||||||
if (!(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) {
|
if (!(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) {
|
||||||
argv_array_push(&child.env_array, "GIT_EDITOR=:");
|
argv_array_push(&child.env_array,
|
||||||
|
"GIT_SEQUENCE_EDITOR=:");
|
||||||
opts->autosquash = 0;
|
opts->autosquash = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,7 +479,7 @@ static int run_specific_rebase(struct rebase_options *opts)
|
||||||
if (is_interactive(opts) &&
|
if (is_interactive(opts) &&
|
||||||
!(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) {
|
!(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) {
|
||||||
strbuf_addstr(&script_snippet,
|
strbuf_addstr(&script_snippet,
|
||||||
"GIT_EDITOR=:; export GIT_EDITOR; ");
|
"GIT_SEQUENCE_EDITOR=:; export GIT_SEQUENCE_EDITOR; ");
|
||||||
opts->autosquash = 0;
|
opts->autosquash = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,8 +176,8 @@ run_interactive () {
|
||||||
|
|
||||||
run_specific_rebase () {
|
run_specific_rebase () {
|
||||||
if [ "$interactive_rebase" = implied ]; then
|
if [ "$interactive_rebase" = implied ]; then
|
||||||
GIT_EDITOR=:
|
GIT_SEQUENCE_EDITOR=:
|
||||||
export GIT_EDITOR
|
export GIT_SEQUENCE_EDITOR
|
||||||
autosquash=
|
autosquash=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -156,6 +156,11 @@ test_expect_success 'rebase -i with exec of inexistent command' '
|
||||||
! grep "Maybe git-rebase is broken" actual
|
! grep "Maybe git-rebase is broken" actual
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'implicit interactive rebase does not invoke sequence editor' '
|
||||||
|
test_when_finished "git rebase --abort ||:" &&
|
||||||
|
GIT_SEQUENCE_EDITOR="echo bad >" git rebase -x"echo one" @^
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'no changes are a nop' '
|
test_expect_success 'no changes are a nop' '
|
||||||
git checkout branch2 &&
|
git checkout branch2 &&
|
||||||
set_fake_editor &&
|
set_fake_editor &&
|
||||||
|
|
|
@ -125,7 +125,7 @@ test_expect_success '`reset` refuses to overwrite untracked files' '
|
||||||
: >dont-overwrite-untracked.t &&
|
: >dont-overwrite-untracked.t &&
|
||||||
echo "reset refs/tags/dont-overwrite-untracked" >script-from-scratch &&
|
echo "reset refs/tags/dont-overwrite-untracked" >script-from-scratch &&
|
||||||
test_config sequence.editor \""$PWD"/replace-editor.sh\" &&
|
test_config sequence.editor \""$PWD"/replace-editor.sh\" &&
|
||||||
test_must_fail git rebase -r HEAD &&
|
test_must_fail git rebase -ir HEAD &&
|
||||||
git rebase --abort
|
git rebase --abort
|
||||||
'
|
'
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@ test_expect_success 'with hook and editor (merge)' '
|
||||||
test_rebase () {
|
test_rebase () {
|
||||||
expect=$1 &&
|
expect=$1 &&
|
||||||
mode=$2 &&
|
mode=$2 &&
|
||||||
test_expect_$expect C_LOCALE_OUTPUT "with hook (rebase $mode)" '
|
test_expect_$expect C_LOCALE_OUTPUT "with hook (rebase ${mode:--i})" '
|
||||||
test_when_finished "\
|
test_when_finished "\
|
||||||
git rebase --abort
|
git rebase --abort
|
||||||
git checkout -f master
|
git checkout -f master
|
||||||
|
@ -225,7 +225,7 @@ test_rebase () {
|
||||||
GIT_EDITOR="\"$FAKE_EDITOR\"" &&
|
GIT_EDITOR="\"$FAKE_EDITOR\"" &&
|
||||||
(
|
(
|
||||||
export GIT_SEQUENCE_EDITOR GIT_EDITOR &&
|
export GIT_SEQUENCE_EDITOR GIT_EDITOR &&
|
||||||
test_must_fail git rebase $mode b &&
|
test_must_fail git rebase -i $mode b &&
|
||||||
echo x >a &&
|
echo x >a &&
|
||||||
git add a &&
|
git add a &&
|
||||||
test_must_fail git rebase --continue &&
|
test_must_fail git rebase --continue &&
|
||||||
|
@ -241,18 +241,18 @@ test_rebase () {
|
||||||
git add b &&
|
git add b &&
|
||||||
git rebase --continue
|
git rebase --continue
|
||||||
) &&
|
) &&
|
||||||
if test $mode = -p # reword amended after pick
|
if test "$mode" = -p # reword amended after pick
|
||||||
then
|
then
|
||||||
n=18
|
n=18
|
||||||
else
|
else
|
||||||
n=17
|
n=17
|
||||||
fi &&
|
fi &&
|
||||||
git log --pretty=%s -g -n$n HEAD@{1} >actual &&
|
git log --pretty=%s -g -n$n HEAD@{1} >actual &&
|
||||||
test_cmp "$TEST_DIRECTORY/t7505/expected-rebase$mode" actual
|
test_cmp "$TEST_DIRECTORY/t7505/expected-rebase${mode:--i}" actual
|
||||||
'
|
'
|
||||||
}
|
}
|
||||||
|
|
||||||
test_rebase success -i
|
test_rebase success
|
||||||
test_have_prereq !REBASE_P || test_rebase success -p
|
test_have_prereq !REBASE_P || test_rebase success -p
|
||||||
|
|
||||||
test_expect_success 'with hook (cherry-pick)' '
|
test_expect_success 'with hook (cherry-pick)' '
|
||||||
|
|
Loading…
Reference in New Issue