chiark / gitweb /
dgit: clone multisuite works even without --no-rm-on-error.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 8 Jul 2017 20:11:52 +0000 (21:11 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 8 Jul 2017 20:11:53 +0000 (21:11 +0100)
This is slightly subtle.

We need $rmonerror in cmd_clone to be cleared.  cmd_clone does that
only when clone itself returns.  The multisuite plumbing means that
currently, clone returns only in the child which set up the tree and
set up the first suite.  Unsetting $rmonerror there is correct because
we want to keep the tree on success, and the parent will remove it if
there is a later failure.  (Ie, the child remains responsible for
removing the tree if it itself fails.)

In the parent, we get $multi_fetched==1 if not only our original clone
child succeeded, but all the other fetches worked too.  We are now
responsible for the tree.  If our final tasks are successful, again,
we need not to delete the tree.

Closes:#867434.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/changelog
dgit

index 729985c30792725c5a3d10c1da79ae9c74f0ad33..686c69cc32eff341af5b798d106b508dcf57cc1e 100644 (file)
@@ -15,6 +15,8 @@ dgit (3.11~) unstable; urgency=medium
     core.sharedRepository.  Prompted by #867603.
   * dgit-badcommit-fixup: Honour core.sharedRepository.
     Closes:#867603.
     core.sharedRepository.  Prompted by #867603.
   * dgit-badcommit-fixup: Honour core.sharedRepository.
     Closes:#867603.
+  * dgit: clone multisuite works even without --no-rm-on-error.
+    Closes:#867434.
   * infrastructure: Cope with new git-receive-pack which has
     quarantine feature: ie, work around #867702.
   * test suite: Cope with git restricting ext:: protocols.
   * infrastructure: Cope with new git-receive-pack which has
     quarantine feature: ie, work around #867702.
   * test suite: Cope with git restricting ext:: protocols.
diff --git a/dgit b/dgit
index be277f3e48e6daca67eec32aa30e7317cda8f194..40b8e32aba4a6378f742381076d1812b239c45f1 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -3612,6 +3612,9 @@ END
 }
 
 sub clone ($) {
 }
 
 sub clone ($) {
+    # in multisuite, returns twice!
+    # once in parent after first suite fetched,
+    # and then again in child after everything is finished
     my ($dstdir) = @_;
     badusage "dry run makes no sense with clone" unless act_local();
 
     my ($dstdir) = @_;
     badusage "dry run makes no sense with clone" unless act_local();
 
@@ -3623,7 +3626,7 @@ sub clone ($) {
         printdebug "multi clone after fetch merge\n";
        clone_set_head();
        clone_finish($dstdir);
         printdebug "multi clone after fetch merge\n";
        clone_set_head();
        clone_finish($dstdir);
-       exit 0;
+       return;
     }
     printdebug "clone main body\n";
 
     }
     printdebug "clone main body\n";