1App::GitHooks::StagedChUasnegresC(o3n)tributed Perl DocuAmpepn:t:aGtiitoHnooks::StagedChanges(3)
2
3
4
6 App::GitHooks::StagedChanged - Staged changes in git.
7
9 Version 1.9.0
10
12 new()
13 Instantiate a new "App::GitHooks::StagedChanges" object.
14
15 my $staged_changes = App::GitHooks::StagedChanges->new(
16 app => $app,
17 );
18
19 Arguments:
20
21 • app (mandatory)
22
23 An "App::GitHook" instance.
24
25 get_app()
26 Return the parent "App::GitHooks" object.
27
28 my $app = $staged_changes->get_app();
29
30 verify()
31 Verify the changes that are being committed.
32
33 This method returns an array composed of:
34
35 • A boolean to indicate whether the checks passed or failed.
36
37 • A boolean to indicate whether any warnings were displayed.
38
39 ( $allow_commit, $has_warnings ) = $staged_changes->verify();
40
41 check_changed_files()
42 Verify that the files changed pass various rules.
43
44 This method returns an array composed of:
45
46 • A boolean to indicate whether the files passed the checks.
47
48 • A boolean to indicate whether any warnings were displayed.
49
50 my ( $all_files_pass, $has_warnings ) = check_changed_files();
51
52 check_file()
53 Verify that that a given file passes all the verification rules.
54
55 This method returns an array composed of:
56
57 • A boolean to indicate whether the file passed all the checks.
58
59 • A boolean to indicate whether any warnings were displayed.
60
61 my ( $file_passes, $has_warnings ) = check_file(
62 count => $count,
63 file => $file,
64 git_action => $git_action,
65 total => $total,
66 );
67
68 Arguments:
69
70 • count (mandatory)
71
72 The number of the file in the list of files to check.
73
74 • file (mandatory)
75
76 The path of the file to check.
77
78 • git_action (mandatory)
79
80 The action performed by git on the file (add, delete, etc).
81
82 • total (mandatory)
83
84 The total number of files to check as part of this git hooks
85 instance.
86
87 run_parallelized_checks()
88 Run in parallel the checks for a given file.
89
90 run_parallelized_checks(
91 tests => $tests,
92 file => $file,
93 git_action => $git_action,
94 );
95
96 Arguments:
97
98 • tests
99
100 An arrayref of tests to run.
101
102 • file
103
104 The path of the file being checked.
105
106 • git_action
107
108 The type of action recorded by git on the file (deletion, addition,
109 etc).
110
111 format_check_output()
112 Format the output of a check against a file into a printable string.
113
114 format_check_output(
115 app => $app,
116 data =>
117 {
118 name => $name,
119 return_value => $return_value,
120 error_message => $error_message,
121 }
122 );
123
124 analyze_changes()
125 Analyze the state of the repository to detect if the changes correspond
126 to a merge or revert operation.
127
128 $staged_changes->analyze_changes();
129
130 is_revert()
131 Return true if the changes correspond to a "git revert" operation,
132 false otherwise.
133
134 my $is_revert = $staged_changes->is_revert();
135
136 is_merge()
137 Return true if the changes correspond to a "git revert" operation,
138 false otherwise.
139
140 my $is_merge = $staged_changes->is_merge();
141
143 Please report any bugs or feature requests through the web interface at
144 <https://github.com/guillaumeaubert/App-GitHooks/issues/new>. I will
145 be notified, and then you'll automatically be notified of progress on
146 your bug as I make changes.
147
149 You can find documentation for this module with the perldoc command.
150
151 perldoc App::GitHooks::StagedChanges
152
153 You can also look for information at:
154
155 • GitHub's request tracker
156
157 <https://github.com/guillaumeaubert/App-GitHooks/issues>
158
159 • AnnoCPAN: Annotated CPAN documentation
160
161 <http://annocpan.org/dist/app-githooks>
162
163 • CPAN Ratings
164
165 <http://cpanratings.perl.org/d/app-githooks>
166
167 • MetaCPAN
168
169 <https://metacpan.org/release/App-GitHooks>
170
172 Guillaume Aubert <https://metacpan.org/author/AUBERTG>, "<aubertg at
173 cpan.org>".
174
176 Copyright 2013-2017 Guillaume Aubert.
177
178 This code is free software; you can redistribute it and/or modify it
179 under the same terms as Perl 5 itself.
180
181 This program is distributed in the hope that it will be useful, but
182 WITHOUT ANY WARRANTY; without even the implied warranty of
183 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE
184 file for more details.
185
186
187
188perl v5.36.0 2023-01-19 App::GitHooks::StagedChanges(3)