summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorThomas Gummerer <t.gummerer@gmail.com>2014-02-23 20:49:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-02-24 17:48:40 (GMT)
commit136347d718320c56030e3b7a3437259e99c4c41b (patch)
tree269f8c0287bef262d7751e0913dfaedadf9b6e34 /t
parent5f95c9f850b19b368c43ae399cc831b17a26a5ac (diff)
downloadgit-136347d718320c56030e3b7a3437259e99c4c41b.zip
git-136347d718320c56030e3b7a3437259e99c4c41b.tar.gz
git-136347d718320c56030e3b7a3437259e99c4c41b.tar.bz2
introduce GIT_INDEX_VERSION environment variable
Respect a GIT_INDEX_VERSION environment variable, when a new index is initialized. Setting the environment variable will not cause existing index files to be converted to another format, but will only affect newly written index files. This can be used to initialize repositories with index-v4. Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t1600-index.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/t/t1600-index.sh b/t/t1600-index.sh
new file mode 100755
index 0000000..6195c55
--- /dev/null
+++ b/t/t1600-index.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+test_description='index file specific tests'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ echo 1 >a
+'
+
+test_expect_success 'bogus GIT_INDEX_VERSION issues warning' '
+ (
+ rm -f .git/index &&
+ GIT_INDEX_VERSION=2bogus &&
+ export GIT_INDEX_VERSION &&
+ git add a 2>&1 | sed "s/[0-9]//" >actual.err &&
+ sed -e "s/ Z$/ /" <<-\EOF >expect.err &&
+ warning: GIT_INDEX_VERSION set, but the value is invalid.
+ Using version Z
+ EOF
+ test_i18ncmp expect.err actual.err
+ )
+'
+
+test_expect_success 'out of bounds GIT_INDEX_VERSION issues warning' '
+ (
+ rm -f .git/index &&
+ GIT_INDEX_VERSION=1 &&
+ export GIT_INDEX_VERSION &&
+ git add a 2>&1 | sed "s/[0-9]//" >actual.err &&
+ sed -e "s/ Z$/ /" <<-\EOF >expect.err &&
+ warning: GIT_INDEX_VERSION set, but the value is invalid.
+ Using version Z
+ EOF
+ test_i18ncmp expect.err actual.err
+ )
+'
+
+test_expect_success 'no warning with bogus GIT_INDEX_VERSION and existing index' '
+ (
+ GIT_INDEX_VERSION=1 &&
+ export GIT_INDEX_VERSION &&
+ git add a 2>actual.err &&
+ >expect.err &&
+ test_i18ncmp expect.err actual.err
+ )
+'
+
+test_done