chiark / gitweb /
dgit: fetch: Introduce new dofetch()
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 4 Jul 2018 00:21:43 +0000 (01:21 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 4 Jul 2018 00:56:59 +0000 (01:56 +0100)
This actually does all that is needed.  It replaces two now-identical
calling patterns.

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

diff --git a/dgit b/dgit
index 5efcc5b16df99e49299509672bab4aea77aaf43e..c7336ddd84b7ea28f5a379ffb328948910059528 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -3738,10 +3738,14 @@ END
     printdone "fetched into ".lrref();
 }
 
-sub pull () {
+sub dofetch () {
     my $multi_fetched = fork_for_multisuite(sub { });
     fetch_one() unless $multi_fetched; # parent
     finish 0 if $multi_fetched eq '0'; # child
+}
+
+sub pull () {
+    dofetch();
     runcmd_ordryrun_local @git, qw(merge -m),"Merge from $csuite [dgit]",
         lrref();
     printdone "fetched to ".lrref()." and merged into HEAD";
@@ -4624,9 +4628,7 @@ sub fetchpullargs () {
 sub cmd_fetch {
     parseopts();
     fetchpullargs();
-    my $multi_fetched = fork_for_multisuite(sub { });
-    fetch_one() unless $multi_fetched; # parent
-    finish 0 if $multi_fetched eq '0'; # child
+    dofetch();
 }
 
 sub cmd_pull {