summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Johannes Schindelin <Johannes.Schindelin@gmx.de>2008-10-07 18:08:21 +0200
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2008-10-08 07:04:44 -0700
commitcced48a808620d60e95a1e51254b135a46ddf719 (patch)
treea377d8f23f86b27a00f88fc78e2b36e2411e93d0
parentFix a few typos in relnotes (diff)
downloadtgif-cced48a808620d60e95a1e51254b135a46ddf719.tar.xz
git rm: refresh index before up-to-date check
Since "git rm" is supposed to be porcelain, we should convince it to be user friendly by refreshing the index itself. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r--builtin-rm.c1
-rwxr-xr-xt/t3600-rm.sh25
2 files changed, 18 insertions, 8 deletions
diff --git a/builtin-rm.c b/builtin-rm.c
index 50ae6d5401..e06640cf8d 100644
--- a/builtin-rm.c
+++ b/builtin-rm.c
@@ -137,6 +137,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
if (read_cache() < 0)
die("index file corrupt");
+ refresh_cache(REFRESH_QUIET);
pathspec = get_pathspec(prefix, argv);
seen = NULL;
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index 558c80edbf..66aca99fd3 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -219,14 +219,23 @@ test_expect_success 'Remove nonexistent file returns nonzero exit status' '
test_expect_success 'Call "rm" from outside the work tree' '
mkdir repo &&
- cd repo &&
- git init &&
- echo something > somefile &&
- git add somefile &&
- git commit -m "add a file" &&
- (cd .. &&
- git --git-dir=repo/.git --work-tree=repo rm somefile) &&
- test_must_fail git ls-files --error-unmatch somefile
+ (cd repo &&
+ git init &&
+ echo something > somefile &&
+ git add somefile &&
+ git commit -m "add a file" &&
+ (cd .. &&
+ git --git-dir=repo/.git --work-tree=repo rm somefile) &&
+ test_must_fail git ls-files --error-unmatch somefile)
+'
+
+test_expect_success 'refresh index before checking if it is up-to-date' '
+
+ git reset --hard &&
+ test-chmtime -86400 frotz/nitfol &&
+ git rm frotz/nitfol &&
+ test ! -f frotz/nitfol
+
'
test_done