chiark / gitweb /
dgit: complete_file_from_dsc: Reorganise $fetchhash
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 10 Jan 2017 14:28:58 +0000 (14:28 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 10 Jan 2017 14:44:46 +0000 (14:44 +0000)
No functional change.

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

diff --git a/dgit b/dgit
index 39d439db059ca0f834bbe29223aabf71f3c16076..c801fa93b1f6bd4c784b0ddd5ce27acd9f19d900 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -2465,17 +2465,14 @@ sub complete_file_from_dsc ($$) {
     my $tf = "$dstdir/$f";
     my $downloaded = 0;
 
+    my $got;
     my $checkhash = sub {
        open F, "<", "$tf" or die "$tf: $!";
        $fi->{Digester}->reset();
        $fi->{Digester}->addfile(*F);
        F->error and die $!;
        my $got = $fi->{Digester}->hexdigest();
-       $got eq $fi->{Hash} or
-           fail "file $f has hash $got but .dsc".
-               " demands hash $fi->{Hash} ".
-               ($downloaded ? "(got wrong file from archive!)"
-                : "(perhaps you should delete this file?)");
+       return $got eq $fi->{Hash};
     };
 
     if (stat_exists $tf) {
@@ -2492,7 +2489,11 @@ sub complete_file_from_dsc ($$) {
        $downloaded = 1;
     }
 
-    $checkhash->();
+    $checkhash->() or
+       fail "file $f has hash $got but .dsc".
+           " demands hash $fi->{Hash} ".
+           ($downloaded ? "(got wrong file from archive!)"
+            : "(perhaps you should delete this file?)");
 
     return 1;
 }