line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
2
|
|
|
2
|
|
39842
|
use warnings; |
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
57
|
|
4
|
2
|
|
|
2
|
|
9
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
68
|
|
5
|
|
|
|
|
|
|
use File::pushd qw(pushd); |
6
|
2
|
|
|
2
|
|
343
|
use IPC::System::Simple qw(capturex); |
|
2
|
|
|
|
|
921
|
|
|
2
|
|
|
|
|
102
|
|
7
|
2
|
|
|
2
|
|
1007
|
use List::SomeUtils qw(uniq); |
|
2
|
|
|
|
|
14200
|
|
|
2
|
|
|
|
|
112
|
|
8
|
2
|
|
|
2
|
|
455
|
use Path::Tiny qw(path); |
|
2
|
|
|
|
|
9834
|
|
|
2
|
|
|
|
|
123
|
|
9
|
2
|
|
|
2
|
|
615
|
|
|
2
|
|
|
|
|
11383
|
|
|
2
|
|
|
|
|
113
|
|
10
|
|
|
|
|
|
|
use Exporter qw(import); |
11
|
2
|
|
|
2
|
|
18
|
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
1029
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.81'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw(git_files_to_commit git_modified_files); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my ($dir) = @_; |
17
|
|
|
|
|
|
|
return _relevant_files_from_status( $dir, 1 ); |
18
|
15
|
|
|
15
|
0
|
5546412
|
} |
19
|
15
|
|
|
|
|
158
|
|
20
|
|
|
|
|
|
|
my ($dir) = @_; |
21
|
|
|
|
|
|
|
return _relevant_files_from_status( $dir, 0 ); |
22
|
|
|
|
|
|
|
} |
23
|
3
|
|
|
3
|
0
|
7111
|
|
24
|
3
|
|
|
|
|
31
|
my ( $dir, $index_only ) = @_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$dir = path($dir); |
27
|
|
|
|
|
|
|
my $pushed = pushd( $dir->absolute ); |
28
|
18
|
|
|
18
|
|
132
|
my $status = capturex(qw( git status --porcelain -z -uno )); |
29
|
|
|
|
|
|
|
|
30
|
18
|
|
|
|
|
234
|
return unless $status; |
31
|
18
|
|
|
|
|
787
|
|
32
|
18
|
|
|
|
|
4177
|
return map { $dir->child($_) } _parse_status( $status, $index_only ); |
33
|
|
|
|
|
|
|
} |
34
|
18
|
100
|
|
|
|
129153
|
|
35
|
|
|
|
|
|
|
my ( $status, $index_only ) = @_; |
36
|
14
|
|
|
|
|
217
|
|
|
7
|
|
|
|
|
200
|
|
37
|
|
|
|
|
|
|
local $_ = $status; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# There can't possibly be more records than nuls plus one, so we use this |
40
|
15
|
|
|
15
|
|
133
|
# as an upper bound on passes. |
41
|
|
|
|
|
|
|
my $times = tr/\0/\0/; |
42
|
15
|
|
|
|
|
169
|
|
43
|
|
|
|
|
|
|
my @files; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
for my $i ( 0 .. $times ) { |
46
|
15
|
|
|
|
|
161
|
last if /\G\Z/gc; |
47
|
|
|
|
|
|
|
|
48
|
15
|
|
|
|
|
84
|
/\G(..) /g; |
49
|
|
|
|
|
|
|
my $mode = $1; |
50
|
15
|
|
|
|
|
167
|
|
51
|
39
|
100
|
|
|
|
345
|
/\G([^\0]+)\0/g; |
52
|
|
|
|
|
|
|
my $name = $1; |
53
|
24
|
|
|
|
|
253
|
|
54
|
24
|
|
|
|
|
467
|
# on renames, parse but throw away the "renamed from" filename |
55
|
|
|
|
|
|
|
if ( $mode =~ /[CR]/ ) { |
56
|
24
|
|
|
|
|
150
|
/\G([^\0]+)\0/g; |
57
|
24
|
|
|
|
|
98
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# deletions and renames don't cause tidying |
60
|
24
|
100
|
|
|
|
155
|
next unless $mode =~ /[MA]/; |
61
|
2
|
|
|
|
|
4
|
next if $index_only && $mode =~ /^ /; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
push @files, $name; |
64
|
|
|
|
|
|
|
} |
65
|
24
|
100
|
|
|
|
155
|
|
66
|
21
|
100
|
100
|
|
|
212
|
return @files; |
67
|
|
|
|
|
|
|
} |
68
|
10
|
|
|
|
|
35
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
15
|
|
|
|
|
174
|
# ABSTRACT: Utilities for the git hook classes |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=pod |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=encoding UTF-8 |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 NAME |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Code::TidyAll::Git::Util - Utilities for the git hook classes |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 VERSION |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
version 0.81 |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 SUPPORT |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/perl-code-tidyall/issues>. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 SOURCE |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
The source code repository for Code-TidyAll can be found at L<https://github.com/houseabsolute/perl-code-tidyall>. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 AUTHORS |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=over 4 |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item * |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Jonathan Swartz <swartz@pobox.com> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item * |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=back |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This software is copyright (c) 2011 - 2022 by Jonathan Swartz. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
113
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
The full text of the license can be found in the |
116
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |