aboutsummaryrefslogtreecommitdiffstats
path: root/t/t0001-init.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t0001-init.sh')
-rwxr-xr-xt/t0001-init.sh30
1 files changed, 21 insertions, 9 deletions
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 72a0c2e7d4..c49d9e0d38 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -586,6 +586,18 @@ test_expect_success 'GIT_DEFAULT_HASH overrides init.defaultObjectFormat' '
echo sha256 >expected
'
+for hash in sha1 sha256
+do
+ test_expect_success "reinit repository with GIT_DEFAULT_HASH=$hash does not change format" '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ git -C repo rev-parse --show-object-format >expect &&
+ GIT_DEFAULT_HASH=$hash git init repo &&
+ git -C repo rev-parse --show-object-format >actual &&
+ test_cmp expect actual
+ '
+done
+
test_expect_success 'extensions.objectFormat is not allowed with repo version 0' '
test_when_finished "rm -rf explicit-v0" &&
git init --object-format=sha256 explicit-v0 &&
@@ -697,6 +709,15 @@ do
git -C refformat rev-parse --show-ref-format >actual &&
test_cmp expect actual
'
+
+ test_expect_success "reinit repository with GIT_DEFAULT_REF_FORMAT=$format does not change format" '
+ test_when_finished "rm -rf refformat" &&
+ git init refformat &&
+ git -C refformat rev-parse --show-ref-format >expect &&
+ GIT_DEFAULT_REF_FORMAT=$format git init refformat &&
+ git -C refformat rev-parse --show-ref-format >actual &&
+ test_cmp expect actual
+ '
done
test_expect_success "--ref-format= overrides GIT_DEFAULT_REF_FORMAT" '
@@ -861,15 +882,6 @@ test_expect_success 're-init with includeIf.onbranch condition' '
test_cmp expect actual
'
-test_expect_success 're-init with includeIf.onbranch condition' '
- test_when_finished "rm -rf repo" &&
- git init repo &&
- git -c includeIf.onbranch:nonexistent.path=/does/not/exist init repo &&
- echo $GIT_DEFAULT_REF_FORMAT >expect &&
- git -C repo rev-parse --show-ref-format >actual &&
- test_cmp expect actual
-'
-
test_expect_success 're-init skips non-matching includeIf.onbranch' '
test_when_finished "rm -rf repo config" &&
cat >config <<-EOF &&