X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=dgit;h=ddcde9acc16148a4a6c1e97d290ef677110ab1e1;hb=84c2dd303ece2a5b2e8d91b332b1e2125a348d15;hp=835366eaed8a5efd42878ce52c261f73e56397b9;hpb=60690f11257949161344ac1392b365179dc763de;p=dgit.git diff --git a/dgit b/dgit index 835366ea..ddcde9ac 100755 --- a/dgit +++ b/dgit @@ -1995,6 +1995,8 @@ END my $format = getfield $dsc, 'Format'; printdebug "format $format\n"; + my $head = git_rev_parse('HEAD'); + if (madformat($format)) { # user might have not used dgit build, so maybe do this now: commit_quilty_patch(); @@ -2025,7 +2027,6 @@ END failedcmd @diffcmd; } } - my $head = git_rev_parse('HEAD'); if (!$changesfile) { my $pat = changespat $cversion; my @cs = glob "$buildproductsdir/$pat"; @@ -2994,20 +2995,15 @@ END sub quilt_check_splitbrain_cache ($$) { my ($headref, $upstreamversion) = @_; - # Checks to see if we are in (potentially) split brain mode. - # If so, computes the cache key and looks in the cache. - # If split brain is not applicable, returns (undef,0). - # Otherwise returns ($cachekey,HIT) where - # HIT=0: miss; HIT=1: hit, needs different commit; HIT=2: same commit OK - - quilt_make_fake_dsc($upstreamversion); - - return (undef,0) unless quiltmode_splitbrain(); + # Called only if we are in (potentially) split brain mode. + # Called in $ud. + # Computes the cache key and looks in the cache. + # Returns ($dgit_view_commitid, $cachekey) or (undef, $cachekey) my $splitbrain_cachekey; progress - "dgit: split brain (separate dgit view) may needed (--quilt=$quilt_mode)."; + "dgit: split brain (separate dgit view) may be needed (--quilt=$quilt_mode)."; # we look in the reflog of dgit-intern/quilt-cache # we look for an entry whose message is the key for the cache lookup my @cachekey = (qw(dgit), $our_version); @@ -3020,6 +3016,7 @@ sub quilt_check_splitbrain_cache ($$) { my $srcshash = Digest::SHA->new(256); my %sfs = ( %INC, '$0(dgit)' => $0 ); foreach my $sfk (sort keys %sfs) { + next unless m/^\$0\b/ || m{^Debian/Dgit\b}; $srcshash->add($sfk," "); $srcshash->add(hashfile($sfs{$sfk})); $srcshash->add("\n"); @@ -3052,16 +3049,16 @@ sub quilt_check_splitbrain_cache ($$) { progress "dgit view: found cached (commit id $cachehit)"; runcmd @git, qw(checkout -q -b dgit-view), $cachehit; $split_brain = 1; - return ($splitbrain_cachekey, 1); + return ($cachehit, $splitbrain_cachekey); } progress "dgit view: found cached, no changes required"; - return ($splitbrain_cachekey, 2); + return ($headref, $splitbrain_cachekey); } die $! if GC->error; failedcmd unless close GC; printdebug "splitbrain cache miss\n"; - return ($splitbrain_cachekey, 0); + return (undef, $splitbrain_cachekey); } sub quilt_fixup_multipatch ($$$) { @@ -3138,10 +3135,16 @@ sub quilt_fixup_multipatch ($$$) { # afterwards with dpkg-source --before-build. That lets us save a # tree object corresponding to .origs. - my ($splitbrain_cachekey,$cachehit) = - quilt_check_splitbrain_cache($headref, $upstreamversion); + my $splitbrain_cachekey; + + quilt_make_fake_dsc($upstreamversion); - return if $splitbrain_cachekey && $cachehit; + if (quiltmode_splitbrain()) { + my $cachehit; + ($cachehit, $splitbrain_cachekey) = + quilt_check_splitbrain_cache($headref, $upstreamversion); + return if $cachehit; + } runcmd qw(sh -ec), 'exec dpkg-source --no-check --skip-patches -x fake.dsc >/dev/null';