{"thread":{"id":"15814","subject":"[PATCH] git rm: refresh index before up-to-date check","startedAt":"2008-10-07T16:08:21Z","lastAt":"2008-10-07T16:08:21Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"92543","messageId":"alpine.DEB.1.00.0810071807500.22125@pacific.mpi-cbg.de.mpi-cbg.de","threadId":"15814","inReplyTo":null,"subject":"[PATCH] git rm: refresh index before up-to-date check","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-10-07T16:08:21Z","receivedAt":"2008-10-07T16:08:21Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nSince \"git rm\" is supposed to be porcelain, we should convince it to\nbe user friendly by refreshing the index itself.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n builtin-rm.c  |    1 +\n t/t3600-rm.sh |   25 +++++++++++++++++--------\n 2 files changed, 18 insertions(+), 8 deletions(-)\n\ndiff --git a/builtin-rm.c b/builtin-rm.c\nindex 50ae6d5..e06640c 100644\n--- a/builtin-rm.c\n+++ b/builtin-rm.c\n@@ -137,6 +137,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)\n \n \tif (read_cache() < 0)\n \t\tdie(\"index file corrupt\");\n+\trefresh_cache(REFRESH_QUIET);\n \n \tpathspec = get_pathspec(prefix, argv);\n \tseen = NULL;\ndiff --git a/t/t3600-rm.sh b/t/t3600-rm.sh\nindex 558c80e..66aca99 100755\n--- a/t/t3600-rm.sh\n+++ b/t/t3600-rm.sh\n@@ -219,14 +219,23 @@ test_expect_success 'Remove nonexistent file returns nonzero exit status' '\n \n test_expect_success 'Call \"rm\" from outside the work tree' '\n \tmkdir repo &&\n-\tcd repo &&\n-\tgit init &&\n-\techo something > somefile &&\n-\tgit add somefile &&\n-\tgit commit -m \"add a file\" &&\n-\t(cd .. &&\n-\t git --git-dir=repo/.git --work-tree=repo rm somefile) &&\n-\ttest_must_fail git ls-files --error-unmatch somefile\n+\t(cd repo &&\n+\t git init &&\n+\t echo something > somefile &&\n+\t git add somefile &&\n+\t git commit -m \"add a file\" &&\n+\t (cd .. &&\n+\t  git --git-dir=repo/.git --work-tree=repo rm somefile) &&\n+\ttest_must_fail git ls-files --error-unmatch somefile)\n+'\n+\n+test_expect_success 'refresh index before checking if it is up-to-date' '\n+\n+\tgit reset --hard &&\n+\ttest-chmtime -86400 frotz/nitfol &&\n+\tgit rm frotz/nitfol &&\n+\ttest ! -f frotz/nitfol\n+\n '\n \n test_done\n-- \n1.6.0.2.713.g3dcb0\n"}]}