Re: [PATCH 0/25] detecting &&-chain breakage
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 21, 2015, 18:01 UTC
- Message-ID
- <xmqq384ydybc.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <20150321081909.GA8221@peff.net>
Jeff King <peff@peff.net> writes:
Show 7 quoted lines
> Running: > > git diff origin origin/jk/test-chain-lint | > perl diff-blame.pl jk/test-chain-lint | > grep EOF > > was fun. At least I am not the only one. :)
The parameter to diff-blame.pl should be origin, instead of jk/test-chain-lint, I presume? You are grabbing the preimage line numbers and asking blame to find out who wrote them.
> Nor the worst in the "severe" category.
I do not quite get what this means---the script does not seem to judge what is severe and what is not, so I presume that this is to be judged by whoever is reading the output from the above pipeline after replacing "grep EOF" with "less" or something?
Show 13 quoted lines
> # diff-blame.pl
> use warnings FATAL => 'all';
> use strict;
>
> my $head = shift
> or die "usage: git diff <start> <end> | $0 <start> [blame-opts]";
>
> my $file;
> my @lines;
> my $line_nr;
>
> while (<STDIN>) {
> if (m{^--- .*?/(.*)}) {This may match a removal of a line that begins with "^-- something/" ;-)
Show 22 quoted lines
> flush();
> $file = $1;
> @lines = ();
> }
> elsif (m{^@@ -(\d+)}) {
> $line_nr = $1;
> }
> elsif (m{^ }) {
> $line_nr++;
> }
> elsif (m{^-}) {
> push @lines, $line_nr++;
> }
> }
> flush();
> exit 0;
>
> sub flush {
> return unless defined $file && @lines > 0;
>
> # XXX coalesce blocks of adjacent lines into ranges?
> system(qw(git --no-pager blame), @ARGV,You may want to pass an option to always show the filename here.
> (map { "-L$_,$_" } @lines), $head, $file);
> }