| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::Greple::git; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = "0.04"; |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
797
|
use v5.14; |
|
|
1
|
|
|
|
|
4
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
26
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
673
|
use Data::Dumper; |
|
|
1
|
|
|
|
|
7246
|
|
|
|
1
|
|
|
|
|
66
|
|
|
9
|
1
|
|
|
1
|
|
518
|
use App::Greple::Common; |
|
|
1
|
|
|
|
|
694
|
|
|
|
1
|
|
|
|
|
163
|
|
|
10
|
1
|
|
|
1
|
|
7
|
use List::Util qw(any); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
101
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
472
|
use File::Spec::Functions qw(canonpath); |
|
|
1
|
|
|
|
|
914
|
|
|
|
1
|
|
|
|
|
219
|
|
|
13
|
|
|
|
|
|
|
*canon = \&canonpath; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub git_file_or_die { |
|
16
|
0
|
|
|
0
|
0
|
|
my %arg = @_; |
|
17
|
0
|
0
|
|
|
|
|
my $name = delete $arg{&FILELABEL} or die; |
|
18
|
0
|
|
|
|
|
|
my $path = canon($name); |
|
19
|
0
|
|
0
|
|
|
|
state $git_files //= do { |
|
20
|
0
|
|
|
|
|
|
my @files = `git ls-files`; |
|
21
|
0
|
|
|
|
|
|
chomp @files; |
|
22
|
0
|
|
|
|
|
|
+{ map { canon($_) => 1 } @files }; |
|
|
0
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
}; |
|
24
|
0
|
0
|
|
|
|
|
$git_files->{$path} or die "SKIP $name"; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=encoding utf-8 |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 NAME |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
git - Greple git module |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
greple -Mgit ... |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
App::Greple::git is a greple module to support git command |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 OPTIONS |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=over 4 |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=item B<--color-blame-line>, B<--color-blame> |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item B<--color-blame-label> |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Read L output and apply unique color for each commit |
|
52
|
|
|
|
|
|
|
id. Option B<--color-blame> and B<--color-blame-line> colorize whole |
|
53
|
|
|
|
|
|
|
line, while B<--color-blame-label> does only labels. |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Set F<$HOME/.gitconfig> like this: |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
[pager] |
|
58
|
|
|
|
|
|
|
blame = greple -Mgit --color-blame-line | env LESSANSIENDCHARS=mK less -cR |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=begin html |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=end html |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=begin html |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=end html |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item B<--color-header-by-author> |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Colorize the commit header in a different color based on the author field. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item B<--color-header-by-field> I |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Generic version of log header colorization. Take a case-insensitive |
|
79
|
|
|
|
|
|
|
field name as a parameter. B<--color-header-by-author> is defined as |
|
80
|
|
|
|
|
|
|
follows: |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
option --color-header-by-author --color-header-by-field Author |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item B<--only-git-files> |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Only files under git control from a given file are processed, all |
|
87
|
|
|
|
|
|
|
other files are ignored. This option is intended to be used in |
|
88
|
|
|
|
|
|
|
combination with B<--glob> or other options that allow many files to |
|
89
|
|
|
|
|
|
|
be processed at once. To target all files under git control, use the |
|
90
|
|
|
|
|
|
|
B<--git> option in the B<-Mdig> module. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=back |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 ENVIRONMENT |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=over 4 |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item B |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item B |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Since B produces ANSI Erase Line terminal sequence, it is |
|
103
|
|
|
|
|
|
|
convenient to set B command understand them. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
LESS=-cR |
|
106
|
|
|
|
|
|
|
LESSANSIENDCHARS=mK |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=back |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 INSTALL |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 CPANMINUS |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
$ cpanm App::Greple::git |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
L |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
L: git diff support |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 AUTHOR |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Kazumasa Utashiro |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 LICENSE |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Copyright 2021-2023 Kazumasa Utashiro. |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
131
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
__DATA__ |