3 # Script helping make fast-forwarding histories while still rebasing
4 # upstream deltas when working on Debian packaging
6 # Copyright (C)2017 Ian Jackson
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
29 my @cmd = qw(git config -z);
30 push @cmd, qw(--get-all) if wantarray;
32 my $out = cmdoutput @cmd;
33 return split /\0/, $out;
39 # git debrebase launder
43 my ($type,$data) = git_cat_file $objid;
44 die unless $type eq 'commit';
45 $data =~ m/(?<=\n)\n/;
49 memoize('get_commit');
51 sub DDEB () { return 0x1; }
52 sub DUPS () { return 0x2; }
53 sub DPAT () { return 0x4; }
56 # go through commits backwards
57 # we generate two lists of commits to apply
58 my (@deb_cl, @ups_cl);
59 my $cur = git_rev_parse('HEAD');
61 my ($h,$m) = get_commit $cur;
62 my ($t) = $h =~ m/^tree (\w+)$/m; defined $t or die $cur;
63 my (@p) = $h =~ m/^parent (\w+)$/m;
64 my (@d) = map { get_differs $t, $_ } @p;
68 # changes on debian/patches, discard it
76 if ($ARGV[0] eq 'launder') {
81 print Dumper(cfg('wombat.foo.bar'));