{"thread":{"id":"6104","subject":"[PATCH 3/5] t3600: update the test for updated git rm","startedAt":"2006-12-25T11:11:17Z","lastAt":"2006-12-25T11:11:17Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"30266","messageId":"7v3b74mdre.fsf@assigned-by-dhcp.cox.net","threadId":"6104","inReplyTo":null,"subject":"[PATCH 3/5] t3600: update the test for updated git rm","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-12-25T11:11:17Z","receivedAt":"2006-12-25T11:11:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Signed-off-by: Junio C Hamano <junkio@cox.net>\n---\n t/t3600-rm.sh |   78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---\n 1 files changed, 74 insertions(+), 4 deletions(-)\n\ndiff --git a/t/t3600-rm.sh b/t/t3600-rm.sh\nindex 201d164..e31cf93 100755\n--- a/t/t3600-rm.sh\n+++ b/t/t3600-rm.sh\n@@ -43,19 +43,19 @@ test_expect_success \\\n \n test_expect_success \\\n     'Test that git-rm foo succeeds' \\\n-    'git-rm foo'\n+    'git-rm --cached foo'\n \n test_expect_success \\\n     'Post-check that foo exists but is not in index after git-rm foo' \\\n     '[ -f foo ] && ! git-ls-files --error-unmatch foo'\n \n test_expect_success \\\n-    'Pre-check that bar exists and is in index before \"git-rm -f bar\"' \\\n+    'Pre-check that bar exists and is in index before \"git-rm bar\"' \\\n     '[ -f bar ] && git-ls-files --error-unmatch bar'\n \n test_expect_success \\\n-    'Test that \"git-rm -f bar\" succeeds' \\\n-    'git-rm -f bar'\n+    'Test that \"git-rm bar\" succeeds' \\\n+    'git-rm bar'\n \n test_expect_success \\\n     'Post-check that bar does not exist and is not in index after \"git-rm -f bar\"' \\\n@@ -84,4 +84,74 @@ test_expect_success \\\n     'When the rm in \"git-rm -f\" fails, it should not remove the file from the index' \\\n     'git-ls-files --error-unmatch baz'\n \n+# Now, failure cases.\n+test_expect_success 'Re-add foo and baz' '\n+\tgit add foo baz &&\n+\tgit ls-files --error-unmatch foo baz\n+'\n+\n+test_expect_success 'Modify foo -- rm should refuse' '\n+\techo >>foo &&\n+\t! git rm foo baz &&\n+\ttest -f foo &&\n+\ttest -f baz &&\n+\tgit ls-files --error-unmatch foo baz\n+'\n+\n+test_expect_success 'Modified foo -- rm -f should work' '\n+\tgit rm -f foo baz &&\n+\ttest ! -f foo &&\n+\ttest ! -f baz &&\n+\t! git ls-files --error-unmatch foo &&\n+\t! git ls-files --error-unmatch bar\n+'\n+\n+test_expect_success 'Re-add foo and baz for HEAD tests' '\n+\techo frotz >foo &&\n+\tgit checkout HEAD -- baz &&\n+\tgit add foo baz &&\n+\tgit ls-files --error-unmatch foo baz\n+'\n+\n+test_expect_success 'foo is different in index from HEAD -- rm should refuse' '\n+\t! git rm foo baz &&\n+\ttest -f foo &&\n+\ttest -f baz &&\n+\tgit ls-files --error-unmatch foo baz\n+'\n+\n+test_expect_success 'but with -f it should work.' '\n+\tgit rm -f foo baz &&\n+\ttest ! -f foo &&\n+\ttest ! -f baz &&\n+\t! git ls-files --error-unmatch foo\n+\t! git ls-files --error-unmatch baz\n+'\n+\n+test_expect_success 'Recursive test setup' '\n+\tmkdir -p frotz &&\n+\techo qfwfq >frotz/nitfol &&\n+\tgit add frotz &&\n+\tgit commit -m \"subdir test\"\n+'\n+\n+test_expect_success 'Recursive without -r fails' '\n+\t! git rm frotz &&\n+\ttest -d frotz &&\n+\ttest -f frotz/nitfol\n+'\n+\n+test_expect_success 'Recursive with -r but dirty' '\n+\techo qfwfq >>frotz/nitfol\n+\t! git rm -r frotz &&\n+\ttest -d frotz &&\n+\ttest -f frotz/nitfol\n+'\n+\n+test_expect_success 'Recursive with -r -f' '\n+\tgit rm -f -r frotz &&\n+\t! test -f frotz/nitfol &&\n+\t! test -d frotz\n+'\n+\n test_done\n-- \n1.4.4.3.g50da\n"}]}