summaryrefslogtreecommitdiffstats
path: root/find-cherry.pl
blob: e53ede6065dcc18af6ff1cd730d0c70757b2f81f (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
27
28
29
30
31
#!/usr/bin/perl
#
# takes git directories as arguments and runs git cherry inside
#
use warnings;
use strict;
use Cwd;

my $ret;

my $startdir = Cwd::cwd();

for my $dir (@ARGV) {
	chdir $startdir;
	next unless -d $dir;
	chdir $dir;

	# ignore non git repos
	system("git rev-parse &>/dev/null");
	if (($? >> 8) == 0) {
		# ignore repos without remotes
		$ret = `git remote`;
		next if ($ret eq "");

		$ret = `git cherry -v origin/master 2>&1`;
		if ($ret ne "") {
			print "$dir\n";
			print $ret;
		}
	}
}