summaryrefslogtreecommitdiff
path: root/t/t0001-init.sh
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2023-12-29 07:27:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2024-01-02 17:24:48 (GMT)
commit48fa45f5fb80de821a380a7ff81ab2c568d69e35 (patch)
tree0ae8dddd0624a39894ff2cba11fefa3418106429 /t/t0001-init.sh
parent3c4a5318afb4978a037c83ccd9bbeb870b3f0543 (diff)
downloadgit-48fa45f5fb80de821a380a7ff81ab2c568d69e35.zip
git-48fa45f5fb80de821a380a7ff81ab2c568d69e35.tar.gz
git-48fa45f5fb80de821a380a7ff81ab2c568d69e35.tar.bz2
builtin/init: introduce `--ref-format=` value flag
Introduce a new `--ref-format` value flag for git-init(1) that allows the user to specify the ref format that is to be used for a newly initialized repository. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0001-init.sh')
-rwxr-xr-xt/t0001-init.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 30ce752..b131d66 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -576,6 +576,32 @@ test_expect_success 'init with GIT_DEFAULT_REF_FORMAT=garbage' '
test_cmp expect err
'
+test_expect_success 'init with --ref-format=files' '
+ test_when_finished "rm -rf refformat" &&
+ git init --ref-format=files refformat &&
+ echo files >expect &&
+ git -C refformat rev-parse --show-ref-format >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 're-init with same format' '
+ test_when_finished "rm -rf refformat" &&
+ git init --ref-format=files refformat &&
+ git init --ref-format=files refformat &&
+ echo files >expect &&
+ git -C refformat rev-parse --show-ref-format >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'init with --ref-format=garbage' '
+ test_when_finished "rm -rf refformat" &&
+ cat >expect <<-EOF &&
+ fatal: unknown ref storage format ${SQ}garbage${SQ}
+ EOF
+ test_must_fail git init --ref-format=garbage refformat 2>err &&
+ test_cmp expect err
+'
+
test_expect_success MINGW 'core.hidedotfiles = false' '
git config --global core.hidedotfiles false &&
rm -rf newdir &&