checkout: do not fail if target is an empty directory
Non-recursive checkout creates empty directpries in place of submodules. If then I try to "checkout --to" submodules there, it refuses to do so, because directory already exists. Fix by allowing checking out to empty directory. Add test and modify the existing one so that it uses non-empty directory. Signed-off-by: Max Kirillov <max@max630.net> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
ad35f61518
commit
ee4fb8435e
@ -865,7 +865,7 @@ static int prepare_linked_checkout(const struct checkout_opts *opts,
|
||||
|
||||
if (!new->commit)
|
||||
die(_("no branch specified"));
|
||||
if (file_exists(path))
|
||||
if (file_exists(path) && !is_empty_dir(path))
|
||||
die(_("'%s' already exists"), path);
|
||||
|
||||
len = strlen(path);
|
||||
|
Reference in New Issue
Block a user