Using check_dir_in_index without checking if the directory is on-disk could get a false positive for partially sparsified directory. Add a note in the documentation to warn potential user. Signed-off-by: Shaoxuan Yuan <shaoxuan.yuan02@xxxxxxxxx> --- builtin/mv.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/builtin/mv.c b/builtin/mv.c index 4729bb1a1a..c8b9069db8 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -132,6 +132,11 @@ static int index_range_of_same_dir(const char *src, int length, * Return 0 if such directory exist (i.e. with any of its contained files not * marked with CE_SKIP_WORKTREE, the directory would be present in working tree). * Return 1 otherwise. + * + * Note: *always* check the directory is not on-disk before this function + * (i.e. using lstat()); + * otherwise it may return a false positive for a partially sparsified + * directory. */ static int check_dir_in_index(const char *name) { -- 2.37.0