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 17b7189..d587527 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -1515,6 +1515,12 @@ sub cmd_clone {
     }
     $dstdir ||= "$package";
 
+    if (stat $dstdir) {
+       fail "$dstdir already exists";
+    } elsif ($! != &ENOENT) {
+       die "$dstdir: $!";
+    }
+
     my $cwd_remove;
     if ($rmonerror && !$dryrun_level) {
        $cwd_remove= getcwd();