mv: check if out-of-cone file exists in index with SKIP_WORKTREE bit
commit6645b03ca5af33bbce1001257ee22832559ec966
authorShaoxuan Yuan <shaoxuan.yuan02@gmail.com>
Thu, 30 Jun 2022 02:37:34 +0000 (30 10:37 +0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 1 Jul 2022 21:50:16 +0000 (1 14:50 -0700)
tree3b8fffe3f89998f3c48bef157a7d4afbcdbaeddf
parent7889755bae89fd792924e95d713a94578b902d11
mv: check if out-of-cone file exists in index with SKIP_WORKTREE bit

Originally, moving a <source> file which is not on-disk but exists in
index as a SKIP_WORKTREE enabled cache entry, "giv mv" command errors
out with "bad source".

Change the checking logic, so that such <source>
file makes "giv mv" command warns with "advise_on_updating_sparse_paths()"
instead of "bad source"; also user now can supply a "--sparse" flag so
this operation can be carried out successfully.

Signed-off-by: Shaoxuan Yuan <shaoxuan.yuan02@gmail.com>
Acked-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/mv.c
t/t7002-mv-sparse-checkout.sh