chiark / gitweb /
Do not remove destination when clone fails because it already exists (!)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 3 Aug 2014 19:25:33 +0000 (20:25 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 3 Aug 2014 19:25:33 +0000 (20:25 +0100)
dgit

diff --git a/dgit b/dgit
index 17b71898eb658660acd65dfbae24e68001cd0e07..d587527cb73c32c271b8d576a846bd3e5061515e 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -1515,6 +1515,12 @@ sub cmd_clone {
     }
     $dstdir ||= "$package";
 
     }
     $dstdir ||= "$package";
 
+    if (stat $dstdir) {
+       fail "$dstdir already exists";
+    } elsif ($! != &ENOENT) {
+       die "$dstdir: $!";
+    }
+
     my $cwd_remove;
     if ($rmonerror && !$dryrun_level) {
        $cwd_remove= getcwd();
     my $cwd_remove;
     if ($rmonerror && !$dryrun_level) {
        $cwd_remove= getcwd();