line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Git::Workflow::Command::Cows; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Created on: 2014-03-11 20:58:59 |
4
|
|
|
|
|
|
|
# Create by: Ivan Wills |
5
|
|
|
|
|
|
|
# $Id$ |
6
|
|
|
|
|
|
|
# $Revision$, $HeadURL$, $Date$ |
7
|
|
|
|
|
|
|
# $Revision$, $Source$, $Date$ |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
85732
|
use strict; |
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
57
|
|
10
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
56
|
|
11
|
2
|
|
|
2
|
|
407
|
use version; |
|
2
|
|
|
|
|
1618
|
|
|
2
|
|
|
|
|
11
|
|
12
|
2
|
|
|
2
|
|
752
|
use Getopt::Long; |
|
2
|
|
|
|
|
10519
|
|
|
2
|
|
|
|
|
14
|
|
13
|
2
|
|
|
2
|
|
1622
|
use Pod::Usage (); |
|
2
|
|
|
|
|
95428
|
|
|
2
|
|
|
|
|
68
|
|
14
|
2
|
|
|
2
|
|
581
|
use Data::Dumper qw/Dumper/; |
|
2
|
|
|
|
|
5260
|
|
|
2
|
|
|
|
|
148
|
|
15
|
2
|
|
|
2
|
|
403
|
use English qw/ -no_match_vars /; |
|
2
|
|
|
|
|
2946
|
|
|
2
|
|
|
|
|
17
|
|
16
|
2
|
|
|
2
|
|
1125
|
use App::Git::Workflow; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
93
|
|
17
|
2
|
|
|
2
|
|
423
|
use App::Git::Workflow::Command qw/get_options/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
597
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = version->new(1.1.16); |
20
|
|
|
|
|
|
|
our $workflow = App::Git::Workflow->new; |
21
|
|
|
|
|
|
|
our ($name) = $PROGRAM_NAME =~ m{^.*/(.*?)$}mxs; |
22
|
|
|
|
|
|
|
our %option; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub run { |
25
|
2
|
|
|
2
|
1
|
10
|
get_options( |
26
|
|
|
|
|
|
|
\%option, |
27
|
|
|
|
|
|
|
'quiet|q', |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
4
|
|
|
|
|
15
|
my @files = map { /^#\s+modified:\s+(.*)\n/ } |
31
|
2
|
|
|
|
|
10
|
grep {/^#\s+modified:\s+/ } |
|
4
|
|
|
|
|
16
|
|
32
|
|
|
|
|
|
|
$workflow->git->status; |
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
25
|
for my $file (@files) { |
35
|
4
|
|
|
|
|
10
|
my $diff = $workflow->git->diff('--ignore-all-space', $file); |
36
|
4
|
|
|
|
|
7
|
chomp $diff; |
37
|
|
|
|
|
|
|
|
38
|
4
|
100
|
|
|
|
8
|
if ( !$diff ) { |
39
|
2
|
100
|
|
|
|
59
|
warn "\t$file\n" unless $option{quiet}; |
40
|
2
|
|
|
|
|
10
|
$workflow->git->checkout($file); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
2
|
|
|
|
|
5
|
return; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__DATA__ |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 NAME |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
git-cows - checkout whitespace only changed files |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 VERSION |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
This documentation refers to git-cows version 1.1.16 |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 SYNOPSIS |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
git-cows [option] |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
OPTIONS: |
64
|
|
|
|
|
|
|
-q --quiet Suppress notifying of files changed |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
-v --verbose Show more detailed option |
67
|
|
|
|
|
|
|
--version Prints the version information |
68
|
|
|
|
|
|
|
--help Prints this help information |
69
|
|
|
|
|
|
|
--man Prints the full documentation for git-cows |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 DESCRIPTION |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
C<git-cows> resets any files that only contain whitespace changes. |
74
|
|
|
|
|
|
|
This is done by finding all files modified (as shown by a C<git status>) and |
75
|
|
|
|
|
|
|
run them through C<git diff -w>. If any file results in no out put is shown |
76
|
|
|
|
|
|
|
(i.e. the changes are only white spaces) the file is then C<git checkout>ed to |
77
|
|
|
|
|
|
|
remove those changes. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This makes it easier make your commits clean of pointless whitespace only |
80
|
|
|
|
|
|
|
changes and makes others work easier. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 C<run ()> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Executes the git workflow command |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
There are no known bugs in this module. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Please report problems to Ivan Wills (ivan.wills@gmail.com). |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Patches are welcome. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 AUTHOR |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Ivan Wills - (ivan.wills@gmail.com) |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Copyright (c) 2014 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077). |
111
|
|
|
|
|
|
|
All rights reserved. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under |
114
|
|
|
|
|
|
|
the same terms as Perl itself. See L<perlartistic>. This program is |
115
|
|
|
|
|
|
|
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
116
|
|
|
|
|
|
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
117
|
|
|
|
|
|
|
PARTICULAR PURPOSE. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |