summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: daf6c2e)
raw | patch | inline | side by side (parent: daf6c2e)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Tue, 7 Oct 2008 16:08:21 +0000 (18:08 +0200) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Wed, 8 Oct 2008 14:04:44 +0000 (07:04 -0700) |
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>
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>
builtin-rm.c | patch | blob | history | |
t/t3600-rm.sh | patch | blob | history |
diff --git a/builtin-rm.c b/builtin-rm.c
index 50ae6d54011fad89387f0d56ce7a4591d07874f3..e06640cf8d3418cbbe177b8fdcdccd19e0f3379f 100644 (file)
--- a/builtin-rm.c
+++ b/builtin-rm.c
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 558c80edbfa5c0c90566a0be94723e2783d6df9b..66aca99fd32c6b98f5e6e34a3cf7b096b3e236cf 100755 (executable)
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
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