chiark / gitweb /
fix dstdir
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 16 Aug 2013 12:23:42 +0000 (13:23 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 16 Aug 2013 12:23:42 +0000 (13:23 +0100)
TODO
dgit

diff --git a/TODO b/TODO
index 6f8d9708b4d51b36879ec0ab935365e4ddf63993..c82759d19573d42d48be42a7cb1070991a2b8e42 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,5 +1,3 @@
-clone support for output dir spec.
-
 config for repo locations
 
 push should push to dgit remote (other branches)
diff --git a/dgit b/dgit
index db65aaac454a447c17365712eaa44089fccd652a..2c4d1bb8bbaabee2aa89740624cc8435f90b890d 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -372,7 +372,8 @@ sub fetch_from_archive () {
     }
 }
 
-sub clone () {
+sub clone ($) {
+    my ($dstdir) = @_;
     die "dry run makes no sense with clone" if $dryrun;
     get_archive_dsc();
     $dsc_hash = $dsc->{$ourdscfield};
@@ -383,7 +384,6 @@ sub clone () {
     } else {
        print "last upload to archive has NO git hash\n";
     }
-    my $dstdir = "$package";
     my $branch = uploadbranch();
     if (check_for_git()) {
        print "cloning existing git history\n";
@@ -482,14 +482,20 @@ sub dopush () {
 }
 
 sub cmd_clone {
+    my $dstdir;
     if (@ARGV==1) {
        ($package) = @ARGV;
-    } elsif (@ARGV==2) {
+    } elsif (@ARGV==2 && $ARGV[1] =~ m#^\w#) {
        ($package,$suite) = @ARGV;
+    } elsif (@ARGV==2 && $ARGV[1] =~ m#^[./]#) {
+       ($package,$dstdir) = @ARGV;
+    } elsif (@ARGV==3) {
+       ($package,$suite,$dstdir) = @ARGV;
     } else {
        die;
     }
-    clone();
+    $dstdir ||= "$package";
+    clone($dstdir);
 }
 
 sub branchsuite () {