]> git.99rst.org Git - git.git/commit
mv: add check_dir_in_index() and solve general dir check issue
authorShaoxuan Yuan <redacted>
Thu, 30 Jun 2022 02:37:37 +0000 (10:37 +0800)
committerJunio C Hamano <redacted>
Fri, 1 Jul 2022 21:50:16 +0000 (14:50 -0700)
commitb91a2b6594a1da7d4d2f936f7db25bfa5a3d775e
treea5f8f4c59962739e6dc3cf784fe4cebafae4fbc8
parent24ea81d9ac401731c222b28097b339aa0d2d316d
mv: add check_dir_in_index() and solve general dir check issue

Originally, moving a <source> directory which is not on-disk due
to its existence outside of sparse-checkout cone, "giv mv" command
errors out with "bad source".

Add a helper check_dir_in_index() function to see if a directory
name exists in the index. Also add a SKIP_WORKTREE_DIR bit to mark
such directories.

Change the checking logic, so that such <source> directory 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.

Helped-by: Victoria Dye <redacted>
Helped-by: Derrick Stolee <redacted>
Signed-off-by: Shaoxuan Yuan <redacted>
Acked-by: Derrick Stolee <redacted>
Signed-off-by: Junio C Hamano <redacted>
builtin/mv.c
t/t1092-sparse-checkout-compatibility.sh
t/t7002-mv-sparse-checkout.sh
git clone https://git.99rst.org/PROJECT