Update TODO
Document how Git::More find Git
Minor POD fixes and cleanups
TODO: CheckWhiteSpace plugin
Fix CheckLog::check_body
Remove uneeded argument from CheckLog::check_title
TODO: I18N and L10N(pt_BR)
TODO: support Gerrit's hooks
Execute tests in a temporary directory

The test harness was being executed without changing directories. This
was risky because any bug in a test could result (as it in fact
resulted) in messing with the author's own Git::Hooks repository.

Now we do a chdir at the start of every test to a temporary
directory.

This change triggered an error in the t/02-gerrit-change-id.t test as
it tried to find the gerrit-commig-msg.sh script in a directory
relative to the current directory, which isn't know. So, I moved the
script to t/02-gerrit-change-id.t's own __DATA__ section and the
script is copied to a file in the temporary directory at the start of
every test, so that its path is relative to a know path.
Use File::pushd to refactor tests

Use the pushd function to make code clearer where before I used a
series of chdir's.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Your branch is ahead of 'origin/master' by 9 commits.
#
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	modified:   t/02-gerrit-change-id.t
#	modified:   t/test-functions.pl
#
diff --git a/t/02-gerrit-change-id.t b/t/02-gerrit-change-id.t
index d665ea8..70bef0c 100755
--- a/t/02-gerrit-change-id.t
+++ b/t/02-gerrit-change-id.t
@@ -6,6 +6,7 @@ use warnings;
 use lib 't';
 use Test::More tests => 44;
 use Cwd;
+use File::pushd;
 use File::Slurp;
 use File::Temp qw/tmpnam/;
 use Git::Hooks::GerritChangeId;
@@ -117,10 +118,9 @@ sub expected {

     write_file($msgfile, $msg);

-    my $dir = getcwd;
-    chdir $repo->repo_path();
+    my $dir = pushd($repo->repo_path());
+
     system($gerrit_script, $msgfile);
-    chdir $dir;

     return read_file($msgfile);
 }
diff --git a/t/test-functions.pl b/t/test-functions.pl
index 2803635..2cc2365 100755
--- a/t/test-functions.pl
+++ b/t/test-functions.pl
@@ -7,6 +7,7 @@ use Cwd;
 use File::Temp qw/tempdir/;
 use File::Spec::Functions ':ALL';
 use File::Copy;
+use File::pushd;
 use File::Remove 'remove';
 use File::Slurp;
 use URI::file;
@@ -21,11 +22,7 @@ $ENV{LC_MESSAGES} = 'C';
 # otherwise the author runs the risk of messing with its local
 # Git::Hooks git repository.

-our $T = tempdir('githooks.XXXXX', TMPDIR => 1, CLEANUP => $ENV{REPO_CLEANUP} || 1);
-chdir $T or die "Can't chdir $T: $!";
-
-# Get out of the temp dir before removing it.
-END { chdir '/' }
+our $T = pushd tempdir('githooks.XXXXX', TMPDIR => 1, CLEANUP => $ENV{REPO_CLEANUP} || 1);

 our $HooksDir = catfile(rel2abs(curdir()), 'hooks');

@@ -123,10 +120,10 @@ sub new_repos {
         # but it started to accept it only on v1.6.5. To support
         # previous gits we chdir to $repodir to avoid the need to pass
         # the argument. Then we have to go back to where we were.
-        my $cwd = cwd();
-        chdir $repodir or die "cannot chdir $repodir: $!\n";
-	my ($ok, $exit, $stdout) = test_command(undef, 'init', '-q');
-        chdir $cwd;
+        my ($ok, $exit, $stdout) = do {
+            my $dir = pushd($repodir);
+            test_command(undef, 'init', '-q');
+        };
 	unless ($ok) {
 	    throw Error::Simple("'git init -q $repodir': exit=$exit, stdout=\n$stdout\n");
 	}
Refactor tests

Reorder use commands and make their syntax uniform.

Get rid of two dependencies on File::Temp::tmpnam by creating all
temporary files inside the temporary directory we create at the start
of every test.
Prepare t/test-functions.pl for rebase testing

The pre-rebase hook is invoked without the GIT_DIR environment
variable and with cwd pointing to the repo's wc_path. We have to
detect this in the hook script in order to define GIT_CONFIG
accordingly.

Define a remote called 'clone' in the 'repo' repository to make it
easier to invoke git push in the tests.

Define a new sub test_ok_match to be used by the post-commit hook.
CheckRewrite: new plugin added

This plugin detects dangerous rewrites in the form of 'git rebase' or
'commit --amend' commands. It implements three hooks for pre-commit,
post-commit, and pre-rebase.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch check-rewrite
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	modified:   .ispell_english
#	modified:   lib/Git/Hooks.pm
#	new file:   lib/Git/Hooks/CheckRewrite.pm
#	new file:   t/02-check-rewrite.t
#
v0.034

        Implement the new Git::Hooks::SafeRewrite plugin to check the
        safety of rewrites, by detecting when we're amending or
        rebasing commits that have already been pushed.