Get rid of any newline inside BAIL_OUT messages

The BAIL_OUT function can't show a message with newlines inside. So,
we have to make sure to get rid of any.

This is to make sense of errors like this:
http://cpantesters.org/cpan/report/bdb7aa9c-6d3d-11e2-a312-f85d9f11b563.

Signed-off-by: Gustavo L. de M. Chaves <gnustavo@cpan.org>
Fix all POD links

I didn't know about the TEXT in L<TEXT|LINK> tag syntax. Now I've
converted every link in the POD documentation.

Signed-off-by: Gustavo L. de M. Chaves <gnustavo@cpan.org>
Improve comments

Signed-off-by: Gustavo L. de M. Chaves <gnustavo@cpan.org>
Git::Hooks: refactor argument preparation

This substitutes a named routine for an anonymous one, just to make
the code clearer.

Also, I'm passing the argument-array by reference in order to make it
faster when we start to support Gerrit's hooks later, since they
receive lots of arguments.

Signed-off-by: Gustavo L. de M. Chaves <gnustavo@cpan.org>
Collect all errors during hook processing

Now, the Git::More::error method collects all error messages submitted
to it in a list and make them available through the new
Git::More::get_errors method.

This allows the Git::Hooks::run_hook routine to avoid having to count
the errors, because it can simply invoke Git::More::get_errors at the
end to know how many have occurred.

Moreover, this will make it possible later on to have a
post-processing phase where all collected error messages are sent as a
whole to some place besides STDERR.

Signed-off-by: Gustavo L. de M. Chaves <gnustavo@cpan.org>
Add MANIFEST.SKIP file to skip t/GITPERLLIB

This was pointed out by Salve J. Nilsen via RT.

Bug: RT-83620
Signed-off-by: Gustavo L. de M. Chaves <gnustavo@cpan.org>
Make Git::More::get_current_branch return the branch full name

Previously, Git::More::get_current_branch was implemented via "git
branch" and returned the current branch short-name (i.e., sans the
refs/head prefix). Now it's reimplemented using the "git symbolic-ref
HEAD" command, which is faster and returns the branch full name
instead.

Signed-off-by: Gustavo L. de M. Chaves <gnustavo@cpan.org>
Fix treatment of close pipe exit value

I was treating the result of 'close' the same way as the result of
'system' but this is wrong. Close returns a boolean value while system
returns $?.

This problem was reported to me by Marcelo Bissaro.

Signed-off-by: Gustavo L. de M. Chaves <gnustavo@cpan.org>
Add missing dependency

The sub Git::Hooks::grok_groups invokes read_file but the module
wasn't being use'd before.

Signed-off-by: Gustavo L. de M. Chaves <gnustavo@cpan.org>
Fix commit grokking on pushing a new branch

The Git::More::get_commits method was invoking git-rev-list with wrong
arguments when it got a null SHA-1 as $old_commit. This is a know
problem discussed, eg, at http://stackoverflow.com/questions/4523668.

Now, in this situation it knows how to prepare a suitable argument
list for git-rev-list.

This bug was reported by Marcelo Bissaro.

Signed-off-by: Gustavo L. de M. Chaves <gnustavo@cpan.org>
Fix commit grokking on deleting a branch

The Git::More::get_commits method was invoking git-rev-list with wrong
arguments when it got a null SHA-1 as $new_commit, which happens when
one pushes to delete a remote branch.

Now, in this situation it returns an empty list, meaning that no new
commit has been pushed.

This bug was reported by Marcelo Bissaro.

Signed-off-by: Gustavo L. de M. Chaves <gnustavo@cpan.org>
Make PerlCritic excuse some violations

These are a few violations that aren't really bad.

Also, make the output of 'tidyall' be verbose.

Signed-off-by: Gustavo L. de M. Chaves <gnustavo@cpan.org>
Refactor: simple optimization

Signed-off-by: Gustavo L. de M. Chaves <gnustavo@cpan.org>
Fix Git::More::is_ref_enabled for when in dettached head state

This method wasn't expecting an undefined ref, but it could happen if
the repo is in the dettached head state. Now, in this situation, it
returns true, meaning that non-refs are enabled by default.

This required a fix to CheckJira also.

Signed-off-by: Gustavo L. de M. Chaves <gnustavo@cpan.org>
v0.039

  [New features]
  - run_hook doesn't die at the first error anymore. Now it collects
    errors from all hooks to be able to show them all when it dies at
    the end. These modification required changes to all plugins to
    make them invoke an error method instead of simply dying.

  [Changes]
  - Git::More::get_current_branch previously returned the branch
    short-name. Now it returns the branch full name. Moreover, when in
    dettached mode it returns undef.

  [Fixes]
  - The exit code of external pre-receive hooks weren't being dealt
    with correctly.

  - The arguments for update and pre-receive hooks weren't being dealt
    with correctly when new branches were being pushed or branches
    were being deteled on a push.

  - Fix Git::More::is_ref_enabled for when in dettached head state. It
    returns true in this case.

  [Cleanup]
  - Fix all L<> POD tags in the documentation.