t3404: set $EDITOR in subshell
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Tue, 15 Oct 2019 10:25:28 +0000 (10:25 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 16 Oct 2019 01:30:51 +0000 (10:30 +0900)
commitb2dbacbddfc40e9715d928dafe3256bb56d91dde
treebfef89981f71195a8b562b85a475021e9f37a35a
parent88a92b6c7372756c862e409a74a22e1ec660b76a
t3404: set $EDITOR in subshell

As $EDITOR is exported setting it in one test affects all subsequent
tests. Avoid this by always setting it in a subshell. This commit leaves
20 calls to set_fake_editor that are not in subshells as they can
safely be removed in the next commit once all the other editor setting
is done inside subshells.

I have moved the call to set_fake_editor in some tests so it comes
immediately before the call to 'git rebase' to avoid moving unrelated
commands into the subshell. In one case ('rebase -ix with
--autosquash') the call to set_fake_editor is moved past an invocation
of 'git rebase'. This is safe as that invocation of 'git rebase'
requires EDITOR=: or EDITOR=fake-editor.sh without FAKE_LINES being
set which will be the case as the preceding tests either set their
editor in a subshell or call set_fake_editor without setting FAKE_LINES.

In a one test ('auto-amend only edited commits after "edit"') a call
to test_tick are now in a subshell. I think this is OK as it is there
to set the date for the next commit which is executed in the same
subshell rather than updating GIT_COMMITTER_DATE for later tests (the
next test calls test_tick before doing anything else).

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3404-rebase-interactive.sh