]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t2107-update-index-basic.sh
Merge branch 'jc/test-i18ngrep'
[thirdparty/git.git] / t / t2107-update-index-basic.sh
index 3d7ca5792e7a35fb250cfdbbb4c2573d01c487b0..cc72ead79f397873b5005196a99baad6b0ba2450 100755 (executable)
@@ -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