summaryrefslogtreecommitdiffstats
path: root/gitmirror/filter-branches.pl
blob: cc08869e1af404c5b6614f6127d9a3b1f9516920 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/perl
$rem = shift @ARGV;
if (defined($rem)) {
    $remopt = '-r';
}
open(GIT, "-|", "git branch $remopt") or die;
%branches = ();
while (<GIT>) {
    chomp;
    s:^[ \*] ::;
    if (defined($rem)) {
	next if (substr($_,0,length($rem)+1) ne $rem.'/');
	$_ = substr($_,length($rem)+1);
    }
    next if (/ \-\> /);
    next if (/^\s*(\#.*|)$/);
    next if (/^(HEAD|build)$/);
    next if (/^auto-/);
    next if (/^tmp-/);
    next if (/^[^\/]+\/base-/);
    $branches{$_}++;
}
close(GIT);
foreach $b (sort(keys(%branches))) {
    print $b, "\n";
}