chiark / gitweb /
dgit: dotdot_bpd_transfer_origs: Change if to early return
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Jan 2019 16:41:48 +0000 (16:41 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Jan 2019 16:41:48 +0000 (16:41 +0000)
This drops an indentation level.  No functional change.

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

diff --git a/dgit b/dgit
index 68ccc42..69f983b 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -2207,60 +2207,60 @@ sub dotdot_bpd_transfer_origs ($$$) {
     my ($bpd_abs, $upstreamversion, $wanted) = @_;
     # checks is_orig_file_of_vsn and if
     # calls $wanted->{$leaf} and expects boolish
-    my $warned;
 
-    if ($buildproductsdir ne '..') {
-       my $dotdot = $maindir;
-       $dotdot =~ s{/[^/]+$}{};
-       opendir DD, $dotdot or fail "opendir .. ($dotdot): $!";
-       while ($!=0, defined(my $leaf = readdir DD)) {
-           {
-               local ($debuglevel) = $debuglevel-1;
-               printdebug "DD_BPD $leaf ?\n";
-           }
-           next unless is_orig_file_of_vsn $leaf, $upstreamversion;
-           next unless $wanted->($leaf);
-           next if lstat "$bpd_abs/$leaf";
+    return if $buildproductsdir eq '..';
 
+    my $warned;
+    my $dotdot = $maindir;
+    $dotdot =~ s{/[^/]+$}{};
+    opendir DD, $dotdot or fail "opendir .. ($dotdot): $!";
+    while ($!=0, defined(my $leaf = readdir DD)) {
+       {
+           local ($debuglevel) = $debuglevel-1;
+           printdebug "DD_BPD $leaf ?\n";
+       }
+       next unless is_orig_file_of_vsn $leaf, $upstreamversion;
+       next unless $wanted->($leaf);
+       next if lstat "$bpd_abs/$leaf";
+
+       print STDERR f_
+ "%s: found orig(s) in .. missing from build-products-dir, transferring:\n",
+           $us
+           unless $warned++;
+       $! == &ENOENT or fail f_
+           "check orig file %s in bpd %s: %s", $leaf, $bpd_abs, $!;
+       lstat "$dotdot/$leaf" or fail f_
+           "check orig file %s in ..: %s", $leaf, $!;
+       if (-l _) {
+           stat "$dotdot/$leaf" or fail f_
+               "check targe of orig symlink %s in ..: %s", $leaf, $!;
+           my $ltarget = readlink "$dotdot/$leaf" or
+               die "readlink $dotdot/$leaf: $!";
+           if ($ltarget !~ m{^/}) {
+               $ltarget = "$dotdot/$ltarget";
+           }
+           symlink $ltarget, "$bpd_abs/$leaf"
+               or die "$ltarget $bpd_abs $leaf: $!";
            print STDERR f_
-"%s: found orig(s) in .. missing from build-products-dir, transferring:\n",
-                $us
-               unless $warned++;
-           $! == &ENOENT or fail f_
-               "check orig file %s in bpd %s: %s", $leaf, $bpd_abs, $!;
-           lstat "$dotdot/$leaf" or fail f_
-               "check orig file %s in ..: %s", $leaf, $!;
-           if (-l _) {
-               stat "$dotdot/$leaf" or fail f_
-                   "check targe of orig symlink %s in ..: %s", $leaf, $!;
-               my $ltarget = readlink "$dotdot/$leaf" or
-                   die "readlink $dotdot/$leaf: $!";
-               if ($ltarget !~ m{^/}) {
-                   $ltarget = "$dotdot/$ltarget";
-               }
-               symlink $ltarget, "$bpd_abs/$leaf"
-                   or die "$ltarget $bpd_abs $leaf: $!";
-               print STDERR f_
  "%s: cloned orig symlink from ..: %s\n",
-                   $us, $leaf;
-           } elsif (link "$dotdot/$leaf", "$bpd_abs/$leaf") {
-               print STDERR f_
+               $us, $leaf;
+       } elsif (link "$dotdot/$leaf", "$bpd_abs/$leaf") {
+           print STDERR f_
  "%s: hardlinked orig from ..: %s\n",
-                   $us, $leaf;
-           } elsif ($! != EXDEV) {
-               fail f_ "failed to make %s a hardlink to %s: %s",
-                   "$bpd_abs/$leaf", "$dotdot/$leaf", $!;
-           } else {
-               symlink "$bpd_abs/$leaf", "$dotdot/$leaf"
-                   or die "$bpd_abs $dotdot $leaf $!";
-               print STDERR f_
+               $us, $leaf;
+       } elsif ($! != EXDEV) {
+           fail f_ "failed to make %s a hardlink to %s: %s",
+               "$bpd_abs/$leaf", "$dotdot/$leaf", $!;
+       } else {
+           symlink "$bpd_abs/$leaf", "$dotdot/$leaf"
+               or die "$bpd_abs $dotdot $leaf $!";
+           print STDERR f_
  "%s: symmlinked orig from .. on other filesystem: %s\n",
-                   $us, $leaf;
-           }
+               $us, $leaf;
        }
-       die "$dotdot; $!" if $!;
-       closedir DD;
     }
+    die "$dotdot; $!" if $!;
+    closedir DD;
 }
 
 sub generate_commits_from_dsc () {