Code-TidyAll

 view release on metacpan or  search on metacpan

lib/Code/TidyAll/Git/Precommit.pm  view on Meta::CPAN

Key/value parameters:

=over 4

=item * conf_name

A conf file name to search for instead of the defaults.

=item * git_path

Path to git to use in commands, e.g. '/usr/bin/git' or '/usr/local/bin/git'. By
default, it just uses 'git', which will search the user's C<PATH>.

=item * no_stash

Don't attempt to stash changes not in the index. This means the hook will
process files that are not going to be committed.

=item * tidyall_class

Subclass to use instead of L<Code::TidyAll>.

=item * tidyall_options

A hashref of options to pass to the L<Code::TidyAll> constructor.

=back

=head1 USING AND (NOT) ENFORCING THIS HOOK

This hook must be placed manually in each copy of the repo - there is no way to
automatically distribute or enforce it. However, you can make things easier on
yourself or your developers as follows:

=over

=item *

Create a directory called F<git/hooks> at the top of your repo (note no dot
prefix).

    mkdir -p git/hooks

=item *

Commit your pre-commit script in F<git/hooks/pre-commit> containing:

    #!/usr/bin/env perl

    use strict;
    use warnings;

    use Code::TidyAll::Git::Precommit;
    Code::TidyAll::Git::Precommit->check();

=item *

Add a setup script in F<git/setup.sh> containing

    #!/bin/bash
    chmod +x git/hooks/pre-commit
    cd .git/hooks
    ln -s ../../git/hooks/pre-commit

=item *

Run C<git/setup.sh> (or tell your developers to run it) once for each new clone
of the repo

=back

See L<this Stack Overflow
question||http://stackoverflow.com/questions/3703159/git-remote-shared-pre-commit-hook>
for more information on pre-commit hooks and the impossibility of enforcing
their use.

See also L<Code::TidyAll::Git::Prereceive>, which enforces tidyall on pushes to
a remote shared repository.

=head1 SUPPORT

Bugs may be submitted at L<https://github.com/houseabsolute/perl-code-tidyall/issues>.

=head1 SOURCE

The source code repository for Code-TidyAll can be found at L<https://github.com/houseabsolute/perl-code-tidyall>.

=head1 AUTHORS

=over 4

=item *

Jonathan Swartz <swartz@pobox.com>

=item *

Dave Rolsky <autarch@urth.org>

=back

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2011 - 2025 by Jonathan Swartz.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

The full text of the license can be found in the
F<LICENSE> file included with this distribution.

=cut



( run in 2.175 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )