提交 4fddf579 编写于 作者: J Junio C Hamano

git-mv: invalidate the removed path properly in cache-tree

The command updated the cache without invalidating the cache
tree entries while removing an existing entry.
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 82ca5055
......@@ -278,6 +278,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
for (i = 0; i < deleted.nr; i++) {
const char *path = deleted.items[i].path;
remove_file_from_cache(path);
cache_tree_invalidate_path(active_cache_tree, path);
}
if (active_cache_changed) {
......
......@@ -86,4 +86,23 @@ test_expect_success \
'move into "."' \
'git-mv path1/path2/ .'
test_expect_success "Michael Cassar's test case" '
rm -fr .git papers partA &&
git init-db &&
mkdir -p papers/unsorted papers/all-papers partA &&
echo a > papers/unsorted/Thesis.pdf &&
echo b > partA/outline.txt &&
echo c > papers/unsorted/_another &&
git add papers partA &&
T1=`git write-tree` &&
git mv papers/unsorted/Thesis.pdf papers/all-papers/moo-blah.pdf &&
T=`git write-tree` &&
git ls-tree -r $T | grep partA/outline.txt || {
git ls-tree -r $T
(exit 1)
}
'
test_done
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册