+ cmdoutput qw(git update-ref -m),"dgit synthesise $clogp->{Version}",
+ 'DGIT_ARCHIVE', $hash;
+ cmdoutput qw(git log -n2), $commithash;
+ # ... gives git a chance to complain if our commit is malformed
+ my $outputhash = $commithash;
+ if (defined $lastupl_hash) {
+ chdir $ud or die $!;
+ runcmd qw(git reset --hard), $lastupl_hash;
+ runcmd qw(sh -ec), 'dpkg-parsechangelog >>../changelogold.tmp';
+ my $oldclogp = Dpkg::Control::Hash->new();
+ $oldclogp->parse('../changelogold.tmp','previous changelog') or die;
+ $vcmp = version_compare_string($oldclogp->{Version}, $clogp->{Version});
+ if ($vcmp < 0) {
+ # git upload/ is earlier vsn than archive, use archive
+ } elsif ($vcmp >= 0) {
+ print STDERR <<END or die $!;
+Version actually in archive: $clogp->{Version} (older)
+Last allegedly pushed/uploaded: $oldclogp->{Version} (newer or same)
+Perhaps the upload is stuck in incoming. Using the version from git.
+END
+ } else {
+ die "version in archive is same as version in git".
+ " to-be-uploaded (upload/) branch but archive".
+ " version hash no commit hash?!\n";
+ }
+ chdir '../../..' or die $!;
+ }