summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2017-04-28 20:30:55 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2018-06-16 12:25:49 +0100
commit3a138686f34b4f85f31e5c339d544d12e6479a32 (patch)
treeb6370acc201ae1c6dbad906d2532bbe5d8413db6
parent84c98f283cda92876a3522a5f541b745797415a8 (diff)
git-debrebase: git-debrebase fixes
-rwxr-xr-xgit-debrebase32
1 files changed, 18 insertions, 14 deletions
diff --git a/git-debrebase b/git-debrebase
index d9bc943..1b77b08 100755
--- a/git-debrebase
+++ b/git-debrebase
@@ -105,6 +105,7 @@
use strict;
use Memoize;
+use Carp;
use Data::Dumper;
use Debian::Dgit qw(:DEFAULT $wa);
@@ -136,6 +137,7 @@ sub D_PAT_OTH () { return 0x8; } # debian/patches other changes
our $rd = ".git/git-debrebase";
our $ud = "$rd/work";
+our @git = qw(git);
sub commit_pr_info ($) {
my ($r) = @_;
@@ -144,7 +146,7 @@ sub commit_pr_info ($) {
sub calculate_committer_authline () {
my $c = cmdoutput @git, qw(commit-tree --no-gpg-sign -m),
- 'DUMMY COMMIT (git-debrebase)', "$basis:";
+ 'DUMMY COMMIT (git-debrebase)', "HEAD:";
my ($h,$m) = get_commit $c;
$h =~ m/^committer .*$/m or confess "($h) ?";
return $&;
@@ -191,13 +193,13 @@ sub classify ($) {
my ($h,$m) = get_commit $objid;
- my ($t) = $h =~ m/^tree (\w+)$/m or die $cur;
+ my ($t) = $h =~ m/^tree (\w+)$/m or die $objid;
my (@ph) = $h =~ m/^parent (\w+)$/m;
my @p;
my $r = {
CommitId => $objid,
- Hdr => $hdr,
+ Hdr => $h,
Msg => $m,
Tree => $t,
Parents => \@p,
@@ -213,26 +215,26 @@ sub classify ($) {
my $classify = sub {
my ($type, @rest) = @_;
- $r = { %r, Type => $type, @rest };
+ $r = { %$r, Type => $type, @rest };
return $r;
};
my $unknown = sub {
my ($why) = @_;
- $r = { %r, Type => Unknown };
+ $r = { %$r, Type => qw(Unknown) };
return $r;
- }
+ };
if (@p == 1) {
my $d = $r->{Parents}[0]{Differs};
- if ($d == D_DPAT_ADD) {
+ if ($d == D_PAT_ADD) {
return $classify->(qw(AddPatches));
- } elsif ($d & (D_DPAT_ADD|D_DPAT_OTH)) {
+ } elsif ($d & (D_PAT_ADD|D_PAT_OTH)) {
return $unknown->("edits debian/patches");
} elsif ($d == D_DEB) {
return $classify->(qw(Packaging));
} elsif ($d == D_UPS) {
return $classify->(qw(Upstream));
- } elsif ($d == D_DEB|D_UPS) {
+ } elsif ($d == (D_DEB|D_UPS)) {
return $classify->(qw(Mixed));
} elsif ($d == 0) {
return $unknown->("no changes");
@@ -262,16 +264,16 @@ sub classify ($) {
SubType => qw(Ambiguous),
Overwritten => $bytime[0],
Contributor => $bytime[1]);
- }!
+ }
foreach my $p (@p) {
my ($p_h, $p_m) = get_commit $p;
$p->{IsOrigin} = $p_h !~ m/^parent \w+$/m;
($p->{IsDgitImport},) = $p_m =~ m/^\[dgit import ([0-9a-z]+) .*\]$/m;
}
- my @orig_ps = grep { ($_->{IsDgitImport}//'X') eq 'orig' };
+ my @orig_ps = grep { ($_->{IsDgitImport}//'X') eq 'orig' } @p;
my $m2 = $m;
if (!(grep { !$_->{IsOrigin} } @p) and
- (@origs >= @p - 1) and
+ (@orig_ps >= @p - 1) and
$m2 =~ s{^\[(dgit import unpatched .*)\]$}{[was: $1]}m) {
$r->{NewMsg} = $m2;
return $classify->(qw(DgitImportUnpatched),
@@ -300,7 +302,8 @@ sub classify ($) {
return $unknown->("complex merge");
}
-sub walk ($;$$$$) {
+sub walk ($;$$$$);
+sub walk {
my ($input,
$nogenerate,$report,
$wantdebonly,$depth) = @_;
@@ -326,9 +329,10 @@ sub walk ($;$$$$) {
};
my $cur = $input;
+ my $basis;
my $prdelim = "";
- my $prprdelim = sub { print $report $prdelim if $report; $prdelim=""; }
+ my $prprdelim = sub { print $report $prdelim if $report; $prdelim=""; };
for (;;) {
$cl = classify $cur;