[libcode-tidyall-perl] 164/374: document --git
Jonas Smedegaard
js at alioth.debian.org
Sun Sep 29 22:26:11 UTC 2013
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository libcode-tidyall-perl.
commit e2290c2486b9fd329c30853f8c7d1aea2a03718f
Author: Jonathan Swartz <swartz at pobox.com>
Date: Sun Sep 2 18:48:16 2012 -0700
document --git
---
bin/tidyall | 10 ++++++++++
lib/Code/TidyAll/Git/Precommit.pm | 14 ++++++++++----
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/bin/tidyall b/bin/tidyall
index 432e454..d7435a7 100755
--- a/bin/tidyall
+++ b/bin/tidyall
@@ -290,6 +290,10 @@ Process all files. Does a recursive search for all files in the project
hierarchy, starting at the root, and processes any file that matches at least
one plugin in the configuration.
+=item -g, --git
+
+Process all added or modified files in the current git working directory.
+
=item -h, --help
Print help message
@@ -479,6 +483,12 @@ according to C<tidyall>, and rejects the commit if not.
=item *
+L<Code::TidyAll::Git::Precommit|Code::TidyAll::Git::Precommit> implements a
+precommit hook that checks if all files are tidied and valid according to
+C<tidyall>, and rejects the commit if not.
+
+=item *
+
L<Test::Code::TidyAll|Test::Code::TidyAll> is a testing library to check that
all the files in your project are in a tidied and valid state.
diff --git a/lib/Code/TidyAll/Git/Precommit.pm b/lib/Code/TidyAll/Git/Precommit.pm
index d942a07..0f20ec7 100644
--- a/lib/Code/TidyAll/Git/Precommit.pm
+++ b/lib/Code/TidyAll/Git/Precommit.pm
@@ -12,6 +12,7 @@ use Try::Tiny;
# Public
has 'conf_file' => ( is => 'ro', default => sub { "tidyall.ini" } );
+has 'no_stash' => ( is => 'ro' );
has 'reject_on_error' => ( is => 'ro' );
has 'tidyall_class' => ( is => 'ro', default => sub { "Code::TidyAll" } );
has 'tidyall_options' => ( is => 'ro', default => sub { {} } );
@@ -32,8 +33,10 @@ sub check {
die "could not find conf file '$conf_file'" unless -f $conf_file;
# Store the stash, and restore it upon exiting this scope
- run("git stash -q --keep-index");
- scope_guard { run("git stash pop -q") };
+ unless ( $self->no_stash ) {
+ run("git stash -q --keep-index");
+ scope_guard { run("git stash pop -q") };
+ }
# Gather file paths to be committed
my $output = capturex( "git", "status", "--porcelain" );
@@ -96,6 +99,9 @@ hook|http://git-scm.com/book/en/Customizing-Git-Git-Hooks> that checks if all
files are tidied and valid according to L<tidyall|tidyall>, and rejects the
commit if not.
+Files are not modified by this hook. If you want to actually tidy files before
+commit,
+
=head1 METHODS
=over
@@ -130,7 +136,7 @@ afterwards, via
git stash pop -q
This means that if C<tidyall.ini> has uncommitted changes that are not in the
-index, they will not be used during the tidyall run.
+index, they will not affect the tidyall run.
Passes mode = "commit" by default; see L<modes|tidyall/MODES>.
@@ -141,7 +147,7 @@ Key/value parameters:
=item no_stash
Don't attempt to stash changes not in the index. This means the hook will
-process all
+process even files that are not going to be committed.
=item tidyall_class
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcode-tidyall-perl.git
More information about the Pkg-perl-cvs-commits
mailing list