diff options
author | Phillip Wood <phillip.wood@dunelm.org.uk> | 2019-10-15 10:25:29 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-10-16 10:30:51 +0900 |
commit | 6a619ca03ce82988f2039ecdfd3565d54aa4d9ed (patch) | |
tree | 3c9c678a0ed8998366539d99f3d19c14f48c043e /t/lib-rebase.sh | |
parent | b2dbacbddfc40e9715d928dafe3256bb56d91dde (diff) | |
download | git-6a619ca03ce82988f2039ecdfd3565d54aa4d9ed.tar.gz |
t3404: remove uneeded calls to set_fake_editor
Some tests were calling set_fake_editor to ensure they had a sane no-op
editor set. Now that all the editor setting is done in subshells these
tests can rely on EDITOR=: and so do not need to call set_fake_editor.
Also add a test at the end to detect any future additions messing with
the exported value of $EDITOR.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/lib-rebase.sh')
-rw-r--r-- | t/lib-rebase.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh index 7ea30e5006..e4554db85e 100644 --- a/t/lib-rebase.sh +++ b/t/lib-rebase.sh @@ -118,3 +118,31 @@ make_empty () { git commit --allow-empty -m "$1" && git tag "$1" } + +# Call this (inside test_expect_success) at the end of a test file to +# check that no tests have changed editor related environment +# variables or config settings +test_editor_unchanged () { + # We're only interested in exported variables hence 'sh -c' + sh -c 'cat >actual <<-EOF + EDITOR=$EDITOR + FAKE_COMMIT_AMEND=$FAKE_COMMIT_AMEND + FAKE_COMMIT_MESSAGE=$FAKE_COMMIT_MESSAGE + FAKE_LINES=$FAKE_LINES + GIT_EDITOR=$GIT_EDITOR + GIT_SEQUENCE_EDITOR=$GIT_SEQUENCE_EDITOR + core.editor=$(git config core.editor) + sequence.editor=$(git config sequence.editor) + EOF' + cat >expect <<-\EOF + EDITOR=: + FAKE_COMMIT_AMEND= + FAKE_COMMIT_MESSAGE= + FAKE_LINES= + GIT_EDITOR= + GIT_SEQUENCE_EDITOR= + core.editor= + sequence.editor= + EOF + test_cmp expect actual +} |