diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-12-10 14:35:07 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-12-10 14:35:07 -0800 |
commit | 03194a1afa0d8dbcf3e556aa51cf9118f38efb2e (patch) | |
tree | ca5a1235d16a23c0ee06cca09845ff4abe2acf6d /t/t0007-git-var.sh | |
parent | Merge branch 'jk/strbuf-addftime-seconds-since-epoch' (diff) | |
parent | var: add GIT_DEFAULT_BRANCH variable (diff) | |
download | tgif-03194a1afa0d8dbcf3e556aa51cf9118f38efb2e.tar.xz |
Merge branch 'tw/var-default-branch'
"git var GIT_DEFAULT_BRANCH" is a way to see what name is used for
the newly created branch if "git init" is run.
* tw/var-default-branch:
var: add GIT_DEFAULT_BRANCH variable
Diffstat (limited to 't/t0007-git-var.sh')
-rwxr-xr-x | t/t0007-git-var.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t0007-git-var.sh b/t/t0007-git-var.sh index 53af92d571..e56f4b9ac5 100755 --- a/t/t0007-git-var.sh +++ b/t/t0007-git-var.sh @@ -27,6 +27,26 @@ test_expect_success !FAIL_PREREQS,!AUTOIDENT 'requested identities are strict' ' ) ' +test_expect_success 'get GIT_DEFAULT_BRANCH without configuration' ' + ( + sane_unset GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME && + git init defbranch && + git -C defbranch symbolic-ref --short HEAD >expect && + git var GIT_DEFAULT_BRANCH >actual && + test_cmp expect actual + ) +' + +test_expect_success 'get GIT_DEFAULT_BRANCH with configuration' ' + test_config init.defaultbranch foo && + ( + sane_unset GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME && + echo foo >expect && + git var GIT_DEFAULT_BRANCH >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. |