summaryrefslogtreecommitdiff
path: root/dgit
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2017-01-10 14:28:58 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2017-01-10 14:44:46 +0000
commit74d54faecadc1cc0815d7888d86d946640528410 (patch)
tree481f7528ee97f2e6a16854dc7f86adfdc1b920c6 /dgit
parent2ad8f4f37376e982077ccdaaa13cdcc6b8da0705 (diff)
dgit: complete_file_from_dsc: Reorganise $fetchhash
No functional change. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'dgit')
-rwxr-xr-xdgit13
1 files changed, 7 insertions, 6 deletions
diff --git a/dgit b/dgit
index 39d439d..c801fa9 100755
--- 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;
}