X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=dgit;h=f77d349b400c344adf13945c6f5e9fd6db3e3b62;hp=562cef08f913eab9dbf2910dccf6da94c00372a7;hb=8d37038bddb78dbe6dcf1c1e2bc515c1dcd7002c;hpb=7c57131ff6c444187b09ed9be5b58e5c0112a5e2 diff --git a/dgit b/dgit index 562cef08..f77d349b 100755 --- a/dgit +++ b/dgit @@ -452,9 +452,9 @@ sub get_archive_dsc () { print DEBUG Dumper($dsc) if $debug>1; my $fmt = getfield $dsc, 'Format'; fail "unsupported source format $fmt, sorry" unless $format_ok{$fmt}; - return $dsc; + return; } - return undef; + $dsc = undef; } sub check_for_git () { @@ -688,17 +688,22 @@ sub git_fetch_us () { sub fetch_from_archive () { # ensures that lrref() is what is actually in the archive, # one way or another - get_archive_dsc() or return 0; - foreach my $field (@ourdscfield) { - $dsc_hash = $dsc->{$field}; - last if defined $dsc_hash; - } - if (defined $dsc_hash) { - $dsc_hash =~ m/\w+/ or fail "invalid hash in .dsc \`$dsc_hash'"; - $dsc_hash = $&; - print "last upload to archive specified git hash\n"; + get_archive_dsc(); + + if ($dsc) { + foreach my $field (@ourdscfield) { + $dsc_hash = $dsc->{$field}; + last if defined $dsc_hash; + } + if (defined $dsc_hash) { + $dsc_hash =~ m/\w+/ or fail "invalid hash in .dsc \`$dsc_hash'"; + $dsc_hash = $&; + print "last upload to archive specified git hash\n"; + } else { + print "last upload to archive has NO git hash\n"; + } } else { - print "last upload to archive has NO git hash\n"; + print "no version available from the archive\n"; } my $lrref_fn = ".git/".lrref(); @@ -734,8 +739,20 @@ END fail "archive's .dsc refers to ".$dsc_hash. " but this is an ancestor of ".$lastpush_hash; } - } else { + } elsif ($dsc) { $hash = generate_commit_from_dsc(); + } elsif ($lastpush_hash) { + # only in git, not in the archive yet + $hash = $lastpush_hash; + print STDERR <