]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/lib-rebase.sh
Merge branch 'pw/post-commit-from-sequencer'
[thirdparty/git.git] / t / lib-rebase.sh
index 6d87961e419e10257b3f619d42004bae0a35d7cf..b72c051f4761609246263c18f5e55a65f0ee9a8f 100644 (file)
@@ -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
+}