X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fgit.git;a=blobdiff_plain;f=t%2Flib-rebase.sh;fp=t%2Flib-rebase.sh;h=b72c051f4761609246263c18f5e55a65f0ee9a8f;hp=6d87961e419e10257b3f619d42004bae0a35d7cf;hb=5c8c0a0d78b0e0ee50ba13823f0cfbee05334461;hpb=b75ba9bbd13877ff3351e150d3d053baec81f0db diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh index 6d87961e41..b72c051f47 100644 --- a/t/lib-rebase.sh +++ b/t/lib-rebase.sh @@ -119,3 +119,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 +}