aboutsummaryrefslogtreecommitdiffstats
path: root/t/t2107-update-index-basic.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-09-20 10:45:12 -0700
committerJunio C Hamano <gitster@pobox.com>2023-09-20 10:45:16 -0700
commit3c2af826a35ecba8533748db5bd0a4dbda2d33db (patch)
tree22eb0337f8113684e786a42a395c574ffb286355 /t/t2107-update-index-basic.sh
parent767e4d68c7dab58e55c4f43ee8a490c946e480b8 (diff)
parent83708f80fc5fc7202df0bf3c0951f85d31249fe3 (diff)
downloadgit-3c2af826a35ecba8533748db5bd0a4dbda2d33db.tar.gz
Merge branch 'jc/update-index-show-index-version'
"git update-index" learns "--show-index-version" to inspect the index format version used by the on-disk index file. * jc/update-index-show-index-version: test-tool: retire "index-version" update-index: add --show-index-version update-index doc: v4 is OK with JGit and libgit2
Diffstat (limited to 't/t2107-update-index-basic.sh')
-rwxr-xr-xt/t2107-update-index-basic.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/t2107-update-index-basic.sh b/t/t2107-update-index-basic.sh
index 89b285fa3a..22f4c92399 100755
--- a/t/t2107-update-index-basic.sh
+++ b/t/t2107-update-index-basic.sh
@@ -111,4 +111,35 @@ test_expect_success '--chmod=+x and chmod=-x in the same argument list' '
test_cmp expect actual
'
+test_expect_success '--index-version' '
+ git commit --allow-empty -m snap &&
+ git reset --hard &&
+ git rm -f -r --cached . &&
+
+ # The default index version is 2 --- update this test
+ # when you change it in the code
+ git update-index --show-index-version >actual &&
+ echo 2 >expect &&
+ test_cmp expect actual &&
+
+ # The next test wants us to be using version 2
+ git update-index --index-version 2 &&
+
+ git update-index --index-version 4 --verbose >actual &&
+ echo "index-version: was 2, set to 4" >expect &&
+ test_cmp expect actual &&
+
+ git update-index --index-version 4 --verbose >actual &&
+ echo "index-version: was 4, set to 4" >expect &&
+ test_cmp expect actual &&
+
+ git update-index --index-version 2 --verbose >actual &&
+ echo "index-version: was 4, set to 2" >expect &&
+ test_cmp expect actual &&
+
+ # non-verbose should be silent
+ git update-index --index-version 4 >actual &&
+ test_must_be_empty actual
+'
+
test_done