{"thread":{"id":"64705","subject":"[GSoC] [PATCH] t7012: turn TODOs into tests for skip-worktree operations","startedAt":"2026-01-01T15:59:28Z","lastAt":"2026-01-01T15:59:28Z","messageCount":1,"participants":["K Jayatheerth"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"532875","messageId":"20260101155916.635049-1-jayatheerthkulkarni2005@gmail.com","threadId":"64705","inReplyTo":null,"subject":"[GSoC] [PATCH] t7012: turn TODOs into tests for skip-worktree operations","fromName":"K Jayatheerth","fromEmail":"jayatheerthkulkarni2005@gmail.com","sentAt":"2026-01-01T15:59:16Z","receivedAt":"2026-01-01T15:59:28Z","isPatch":true,"sender":{"key":"jayatheerthkulkarni2005@gmail.com","avatar":"https://avatars.githubusercontent.com/u/148841023?v=4"},"body":"The t7012-skip-worktree-writing.sh test script contained several\nplaceholders marked with '#TODO test_expect_failure ... false',\nindicating intended test coverage for skip-worktree interactions\nthat had not yet been implemented.\n\nImplement these tests to verify the behavior of git-apply, git-mv,\nand git-checkout when dealing with skip-worktree entries.\n\nThe results of the new tests are:\n1. git-apply (adding a file): Works correctly.\n2. git-mv (to skip-worktree): Works correctly.\n3. git-checkout: Works correctly (updates index despite missing file).\n\n4. git-apply (update/remove): Fails as expected.\n5. git-mv (from skip-worktree): Fails as expected.\n\nTests that pass have been marked as 'test_expect_success', while\nthose that confirm known bugs are marked as 'test_expect_failure'.\n\nSigned-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>\n---\n t/t7012-skip-worktree-writing.sh | 101 +++++++++++++++++++++++++++++--\n 1 file changed, 95 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t7012-skip-worktree-writing.sh b/t/t7012-skip-worktree-writing.sh\nindex cd5c20fe51..7e6c529b6f 100755\n--- a/t/t7012-skip-worktree-writing.sh\n+++ b/t/t7012-skip-worktree-writing.sh\n@@ -188,11 +188,100 @@ test_expect_success 'stash restore in sparse checkout' '\n \t)\n '\n \n-#TODO test_expect_failure 'git-apply adds file' false\n-#TODO test_expect_failure 'git-apply updates file' false\n-#TODO test_expect_failure 'git-apply removes file' false\n-#TODO test_expect_failure 'git-mv to skip-worktree' false\n-#TODO test_expect_failure 'git-mv from skip-worktree' false\n-#TODO test_expect_failure 'git-checkout' false\n+test_expect_success 'setup patches' '\n+\ttest_commit setup_apply &&\n+\n+\t# 1. Modify patch\n+\techo modified >setup_apply.t &&\n+\tgit diff setup_apply.t >modify.patch &&\n+\tgit checkout setup_apply.t &&\n+\n+\t# 2. Remove patch\n+\trm setup_apply.t &&\n+\tgit diff -- setup_apply.t >remove.patch &&\n+\tgit checkout setup_apply.t &&\n+\n+\t# 3. Add patch\n+\techo new >newfile.t &&\n+\tgit add newfile.t &&\n+\tgit diff --cached newfile.t >add.patch &&\n+\tgit rm --cached newfile.t &&\n+\trm newfile.t\n+'\n+\n+test_expect_success 'git-apply adds file' '\n+\ttest_when_finished \"git update-index --no-skip-worktree newfile.t\" &&\n+\n+\t>newfile.t &&\n+\tgit add newfile.t &&\n+\tgit update-index --skip-worktree newfile.t &&\n+\trm newfile.t &&\n+\n+\tgit apply add.patch\n+'\n+\n+test_expect_failure 'git-apply updates file' '\n+\ttest_when_finished \"git update-index --no-skip-worktree setup_apply.t\" &&\n+\n+\tgit update-index --skip-worktree setup_apply.t &&\n+\trm setup_apply.t &&\n+\n+\tgit apply modify.patch\n+'\n+\n+test_expect_failure 'git-apply removes file' '\n+\ttest_when_finished \"git update-index --no-skip-worktree setup_apply.t\" &&\n+\n+\tgit update-index --skip-worktree setup_apply.t &&\n+\trm setup_apply.t &&\n+\n+\tgit apply remove.patch\n+'\n+\n+test_expect_success 'git-mv to skip-worktree' '\n+\ttest_when_finished \"git update-index --no-skip-worktree dest.t\" &&\n+\n+\ttest_commit mv_source &&\n+\t>dest.t &&\n+\tgit add dest.t &&\n+\tgit update-index --skip-worktree dest.t &&\n+\trm dest.t &&\n+\n+\tgit mv mv_source.t dest.t\n+'\n+\n+test_expect_failure 'git-mv from skip-worktree' '\n+\ttest_when_finished \"git update-index --no-skip-worktree mv_skip.t\" &&\n+\n+\ttest_commit mv_skip &&\n+\tgit update-index --skip-worktree mv_skip.t &&\n+\trm mv_skip.t &&\n+\n+\tgit mv mv_skip.t moved_skip.t &&\n+\tgit ls-files --error-unmatch moved_skip.t\n+'\n+\n+test_expect_success 'git-checkout' '\n+\ttest_create_repo checkout_test &&\n+\t(\n+\t\tcd checkout_test &&\n+\t\tgit checkout -B master &&\n+\n+\t\ttest_commit checkout_base &&\n+\t\tgit checkout -b side &&\n+\t\ttest_commit modified_checkout &&\n+\t\tgit checkout master &&\n+\n+\t\tgit update-index --skip-worktree checkout_base.t &&\n+\t\trm checkout_base.t &&\n+\n+\t\tgit checkout side &&\n+\n+\t\ttest_path_is_missing checkout_base.t &&\n+\t\tgit rev-parse :checkout_base.t >actual &&\n+\t\tgit rev-parse side:checkout_base.t >expect &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n \n test_done\n-- \n2.52.0\n\n"}]}