NAME

App::GitHooks::StagedChanged - Staged changes in git.

VERSION

Version 1.7.1

METHODS

new()

Instantiate a new App::GitHooks::StagedChanges object.

my $staged_changes = App::GitHooks::StagedChanges->new(
	app => $app,
);

Arguments:

  • app (mandatory)

    An App::GitHook instance.

get_app()

Return the parent App::GitHooks object.

my $app = $staged_changes->get_app();

verify()

Verify the changes that are being committed, and return information on whether the checks passed or failed.

# TODO: update documentation.

my $checks_pass = $staged_changes->verify(
	use_colors   => $use_colors, # default 1
	app          => $app,
);

check_changed_files()

Verify that the files changed pass various rules. Return a boolean indicating if all the files pass (true) or fail (false) the tests.

# TODO: update documentation.

my ( $all_files_pass, $warnings ) = check_changed_files();

check_file()

Verify that that a given file passes all the verification rules.

# TODO: update documentation.

my ( $file_passes, $warnings ) = check_file( $file );

run_parallelized_checks()

Run in parallel the checks for a given file.

run_parallelized_checks(
	tests	  => $tests,
	file	   => $file,
	git_action => $git_action,
);

Arguments:

  • tests

    An arrayref of tests to run.

  • file

    The path of the file being checked.

  • git_action

    The type of action recorded by git on the file (deletion, addition, etc).

format_check_output()

Format the output of a check against a file into a printable string.

format_check_output(
	app  => $app,
	data =>
	{
		name          => $name,
		return_value  => $return_value,
		error_message => $error_message,
	}
);

analyze_changes()

Analyze the state of the repository to detect if the changes correspond to a merge or revert operation.

$staged_changes->analyze_changes();

is_revert()

Return true if the changes correspond to a git revert operation, false otherwise.

my $is_revert = $staged_changes->is_revert();

is_merge()

Return true if the changes correspond to a git revert operation, false otherwise.

my $is_merge = $staged_changes->is_merge();

BUGS

Please report any bugs or feature requests through the web interface at https://github.com/guillaumeaubert/App-GitHooks/issues/new. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc App::GitHooks::StagedChanges

You can also look for information at:

AUTHOR

Guillaume Aubert, <aubertg at cpan.org>.

COPYRIGHT & LICENSE

Copyright 2013-2015 Guillaume Aubert.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/