Skip to content

Commit ed3dc1d

Browse files
committed
Convert indentation consistently to tabs
1 parent 275a5e3 commit ed3dc1d

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

git-diff-blame

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#!/usr/bin/perl -w
22

33
sub parse_hunk_header {
4-
my ($line) = @_;
5-
my ($o_ofs, $o_cnt, $n_ofs, $n_cnt) =
6-
$line =~ /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;
7-
$o_cnt = 1 unless defined $o_cnt;
8-
$n_cnt = 1 unless defined $n_cnt;
9-
return ($o_ofs, $o_cnt, $n_ofs, $n_cnt);
4+
my ($line) = @_;
5+
my ($o_ofs, $o_cnt, $n_ofs, $n_cnt) =
6+
$line =~ /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;
7+
$o_cnt = 1 unless defined $o_cnt;
8+
$n_cnt = 1 unless defined $n_cnt;
9+
return ($o_ofs, $o_cnt, $n_ofs, $n_cnt);
1010
}
1111

1212
sub get_blame_prefix {
13-
my ($line) = @_;
14-
$line =~ /^([0-9a-f]+\s+(\S+\s+)?\([^\)]+\))/ or die "bad blame output: $line";
15-
return $1;
13+
my ($line) = @_;
14+
$line =~ /^([0-9a-f]+\s+(\S+\s+)?\([^\)]+\))/ or die "bad blame output: $line";
15+
return $1;
1616
}
1717

1818
my ($oldrev, $newrev) = @ARGV;
@@ -21,46 +21,46 @@ open($diff, '-|', 'git', '--no-pager', 'diff', $oldrev, $newrev) or die;
2121
my ($pre, $post);
2222
my $filename;
2323
while (<$diff>) {
24-
if (m{^diff --git ./(.*) ./\1$}) {
24+
if (m{^diff --git ./(.*) ./\1$}) {
2525
close $pre if defined $pre;
2626
close $post if defined $post;
2727
print;
28-
$prefilename = "./" . $1;
29-
$postfilename = "./" . $1;
28+
$prefilename = "./" . $1;
29+
$postfilename = "./" . $1;
3030
$delete = $create = 0;
31-
} elsif (m{^new file}) {
31+
} elsif (m{^new file}) {
3232
$create = 1;
3333
$prefilename = '/dev/null';
34-
} elsif (m{^deleted file}) {
34+
} elsif (m{^deleted file}) {
3535
$delete = 1;
3636
$postfilename = '/dev/null';
37-
} elsif (m{^--- $prefilename$}) {
38-
# ignore
37+
} elsif (m{^--- $prefilename$}) {
38+
# ignore
3939
print;
40-
} elsif (m{^\+\+\+ $postfilename$}) {
41-
# ignore
40+
} elsif (m{^\+\+\+ $postfilename$}) {
41+
# ignore
4242
print;
43-
} elsif (m{^@@ }) {
44-
my ($o_ofs, $o_cnt, $n_ofs, $n_cnt)
45-
= parse_hunk_header($_);
46-
my $o_end = $o_ofs + $o_cnt - 1;
47-
my $n_end = $n_ofs + $n_cnt - 1;
43+
} elsif (m{^@@ }) {
44+
my ($o_ofs, $o_cnt, $n_ofs, $n_cnt)
45+
= parse_hunk_header($_);
46+
my $o_end = $o_ofs + $o_cnt - 1;
47+
my $n_end = $n_ofs + $n_cnt - 1;
4848
if (!$create) {
4949
open($pre, '-|', 'git', 'blame', '-M', "-L$o_ofs,$o_end",
50-
"-l",
50+
"-l",
5151
$oldrev, '--', $prefilename) or die;
5252
}
5353
if (!$delete) {
5454
open($post, '-|', 'git', 'blame', '-M', "-L$n_ofs,$n_end",
55-
"-l",
55+
"-l",
5656
$newrev, '--', $postfilename) or die;
5757
}
58-
} elsif (m{^ }) {
59-
print get_blame_prefix(scalar <$pre>), "\t", $_;
60-
scalar <$post>; # discard
61-
} elsif (m{^\-}) {
62-
print get_blame_prefix(scalar <$pre>), "\t", $_;
63-
} elsif (m{^\+}) {
64-
print get_blame_prefix(scalar <$post>), "\t", $_;
65-
}
58+
} elsif (m{^ }) {
59+
print get_blame_prefix(scalar <$pre>), "\t", $_;
60+
scalar <$post>; # discard
61+
} elsif (m{^\-}) {
62+
print get_blame_prefix(scalar <$pre>), "\t", $_;
63+
} elsif (m{^\+}) {
64+
print get_blame_prefix(scalar <$post>), "\t", $_;
65+
}
6666
}

0 commit comments

Comments
 (0)