line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
2
|
|
|
2
|
|
40357
|
use warnings; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
51
|
|
4
|
2
|
|
|
2
|
|
10
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
58
|
|
5
|
|
|
|
|
|
|
use File::pushd qw(pushd); |
6
|
2
|
|
|
2
|
|
371
|
use IPC::System::Simple qw(capturex); |
|
2
|
|
|
|
|
1040
|
|
|
2
|
|
|
|
|
108
|
|
7
|
2
|
|
|
2
|
|
992
|
use List::SomeUtils qw(uniq); |
|
2
|
|
|
|
|
15045
|
|
|
2
|
|
|
|
|
120
|
|
8
|
2
|
|
|
2
|
|
477
|
use Path::Tiny qw(path); |
|
2
|
|
|
|
|
10980
|
|
|
2
|
|
|
|
|
141
|
|
9
|
2
|
|
|
2
|
|
728
|
|
|
2
|
|
|
|
|
9831
|
|
|
2
|
|
|
|
|
84
|
|
10
|
|
|
|
|
|
|
use Exporter qw(import); |
11
|
2
|
|
|
2
|
|
11
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
798
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.82'; |
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
|
5199207
|
} |
19
|
15
|
|
|
|
|
157
|
|
20
|
|
|
|
|
|
|
my ($dir) = @_; |
21
|
|
|
|
|
|
|
return _relevant_files_from_status( $dir, 0 ); |
22
|
|
|
|
|
|
|
} |
23
|
3
|
|
|
3
|
0
|
6799
|
|
24
|
3
|
|
|
|
|
32
|
my ( $dir, $index_only ) = @_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$dir = path($dir); |
27
|
|
|
|
|
|
|
my $pushed = pushd( $dir->absolute ); |
28
|
18
|
|
|
18
|
|
63
|
my $status = capturex(qw( git status --porcelain -z -uno )); |
29
|
|
|
|
|
|
|
|
30
|
18
|
|
|
|
|
196
|
return unless $status; |
31
|
18
|
|
|
|
|
728
|
|
32
|
18
|
|
|
|
|
3956
|
return map { $dir->child($_) } _parse_status( $status, $index_only ); |
33
|
|
|
|
|
|
|
} |
34
|
18
|
100
|
|
|
|
119313
|
|
35
|
|
|
|
|
|
|
my ( $status, $index_only ) = @_; |
36
|
14
|
|
|
|
|
239
|
|
|
7
|
|
|
|
|
213
|
|
37
|
|
|
|
|
|
|
local $_ = $status; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# There can't possibly be more records than nuls plus one, so we use this |
40
|
15
|
|
|
15
|
|
107
|
# as an upper bound on passes. |
41
|
|
|
|
|
|
|
my $times = tr/\0/\0/; |
42
|
15
|
|
|
|
|
190
|
|
43
|
|
|
|
|
|
|
my @files; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
for my $i ( 0 .. $times ) { |
46
|
15
|
|
|
|
|
198
|
last if /\G\Z/gc; |
47
|
|
|
|
|
|
|
|
48
|
15
|
|
|
|
|
84
|
/\G(..) /g; |
49
|
|
|
|
|
|
|
my $mode = $1; |
50
|
15
|
|
|
|
|
165
|
|
51
|
39
|
100
|
|
|
|
297
|
/\G([^\0]+)\0/g; |
52
|
|
|
|
|
|
|
my $name = $1; |
53
|
24
|
|
|
|
|
268
|
|
54
|
24
|
|
|
|
|
442
|
# on renames, parse but throw away the "renamed from" filename |
55
|
|
|
|
|
|
|
if ( $mode =~ /[CR]/ ) { |
56
|
24
|
|
|
|
|
162
|
/\G([^\0]+)\0/g; |
57
|
24
|
|
|
|
|
101
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# deletions and renames don't cause tidying |
60
|
24
|
100
|
|
|
|
143
|
next unless $mode =~ /[MA]/; |
61
|
2
|
|
|
|
|
10
|
next if $index_only && $mode =~ /^ /; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
push @files, $name; |
64
|
|
|
|
|
|
|
} |
65
|
24
|
100
|
|
|
|
139
|
|
66
|
21
|
100
|
100
|
|
|
219
|
return @files; |
67
|
|
|
|
|
|
|
} |
68
|
10
|
|
|
|
|
37
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
15
|
|
|
|
|
195
|
# 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.82 |
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 |