X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=dgit;h=91f43af087372c02b0f6ad719f93a60b07a94002;hp=9edc6577a4feb3a46129321570bac783ade70c11;hb=6b6d2e426e5ee6b08c706d57db7502d80e00e82b;hpb=9810537db1cd42febc3283a69fa6c09b5b212f30 diff --git a/dgit b/dgit index 9edc6577..91f43af0 100755 --- a/dgit +++ b/dgit @@ -2131,7 +2131,13 @@ sub cmd_clone { return if $!==&ENOENT; die "chdir $cwd_remove: $!"; } - rmtree($dstdir) or die "remove $dstdir: $!\n"; + if (stat $dstdir) { + rmtree($dstdir) or die "remove $dstdir: $!\n"; + } elsif (!grep { $! == $_ } + (ENOENT, ENOTDIR, EACCES, EPERM, ELOOP)) { + } else { + print STDERR "check whether to remove $dstdir: $!\n"; + } }; }