diff options
author | Sean Allred <allred.sean@gmail.com> | 2022-12-18 02:09:59 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-12-18 05:48:26 +0300 |
commit | 4c3dd9304e49402bd4ee19dfaa4c21d0217fb582 (patch) | |
tree | 9c3ec1efa172c19c821375a83e9c865991bb833f /t/t0007-git-var.sh | |
parent | 57e2c6ebbe7108b35ba30184dcbcb6c34c929ad8 (diff) |
var: add GIT_SEQUENCE_EDITOR variable
The editor program used by Git when editing the sequencer "todo" file
is determined by examining a few environment variables and also
affected by configuration variables. Introduce "git var
GIT_SEQUENCE_EDITOR" to give users access to the final result of the
logic without having to know the exact details.
This is very similar in spirit to 44fcb497 (Teach git var about
GIT_EDITOR, 2009-11-11) that introduced "git var GIT_EDITOR".
Signed-off-by: Sean Allred <allred.sean@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0007-git-var.sh')
-rwxr-xr-x | t/t0007-git-var.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/t/t0007-git-var.sh b/t/t0007-git-var.sh index 433d242897..eeb8539c1b 100755 --- a/t/t0007-git-var.sh +++ b/t/t0007-git-var.sh @@ -109,6 +109,44 @@ test_expect_success 'get GIT_EDITOR with configuration and environment variable ) ' +test_expect_success 'get GIT_SEQUENCE_EDITOR without configuration' ' + ( + sane_unset GIT_SEQUENCE_EDITOR && + git var GIT_EDITOR >expect && + git var GIT_SEQUENCE_EDITOR >actual && + test_cmp expect actual + ) +' + +test_expect_success 'get GIT_SEQUENCE_EDITOR with configuration' ' + test_config sequence.editor foo && + ( + sane_unset GIT_SEQUENCE_EDITOR && + echo foo >expect && + git var GIT_SEQUENCE_EDITOR >actual && + test_cmp expect actual + ) +' + +test_expect_success 'get GIT_SEQUENCE_EDITOR with environment variable' ' + ( + sane_unset GIT_SEQUENCE_EDITOR && + echo bar >expect && + GIT_SEQUENCE_EDITOR=bar git var GIT_SEQUENCE_EDITOR >actual && + test_cmp expect actual + ) +' + +test_expect_success 'get GIT_SEQUENCE_EDITOR with configuration and environment variable' ' + test_config sequence.editor foo && + ( + sane_unset GIT_SEQUENCE_EDITOR && + echo bar >expect && + GIT_SEQUENCE_EDITOR=bar git var GIT_SEQUENCE_EDITOR >actual && + test_cmp expect actual + ) +' + # For git var -l, we check only a representative variable; # testing the whole output would make our test too brittle with # respect to unrelated changes in the test suite's environment. |