Fourth batch
[gitweb.git] / t / t2022-checkout-paths.sh
index 8e3545d8680c5f5179977082849388b1b31c17d8..6844afafc0eb926713e73c1042874155d18c08bc 100755 (executable)
@@ -61,4 +61,32 @@ test_expect_success 'do not touch unmerged entries matching $path but not in $tr
        test_cmp expect.next0 actual.next0
 '
 
+test_expect_success 'do not touch files that are already up-to-date' '
+       git reset --hard &&
+       echo one >file1 &&
+       echo two >file2 &&
+       git add file1 file2 &&
+       git commit -m base &&
+       echo modified >file1 &&
+       test-tool chmtime =1000000000 file2 &&
+       git update-index -q --refresh &&
+       git checkout HEAD -- file1 file2 &&
+       echo one >expect &&
+       test_cmp expect file1 &&
+       echo "1000000000" >expect &&
+       test-tool chmtime --get file2 >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'checkout HEAD adds deleted intent-to-add file back to index' '
+       echo "nonempty" >nonempty &&
+       >empty &&
+       git add nonempty empty &&
+       git commit -m "create files to be deleted" &&
+       git rm --cached nonempty empty &&
+       git add -N nonempty empty &&
+       git checkout HEAD nonempty empty &&
+       git diff --cached --exit-code
+'
+
 test_done