Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 35 lines (31 sloc) 789 Bytes
#!/usr/bin/perl
my $gitdir = `git rev-parse --git-dir`;
chomp $gitdir;
if (-e "$gitdir/rebase-merge/done") {
# Show some context.
system('tail', '-1', "$gitdir/rebase-merge/done");
print "\n";
}
my $conflicts = 0;
my $root = `realpath $gitdir/..`;
chomp $root;
chdir $root;
open GIT, "git status |";
while (<GIT>) {
chomp;
s/^#?\s*//;
if (s/^((?:added|deleted) by (?:them|us)):\s*// or s/^(both (?:added|modified)):\s*//) {
my $found = 0;
if ($1 eq 'both modified' or $1 eq 'both added') {
open GREP, "grep -n ^======= $root/$_ | cut -d: -f1 |";
while (my $line = <GREP>) {
chomp $line;
print "$root/$_:$line: $1\n";
$found = 1;
}
}
print "$root/$_:1: $1\n" unless $found;
$conflicts = 1;
}
}
exit $conflicts;