Makefile: extract perl-related rules to make them available from other dirs

The final goal is to make it easy to write Git commands in perl in the
contrib/ directory. It is currently possible to do so, but without the
benefits of Git's Makefile: adapt first line with $(PERL_PATH),
hardcode the path to Git.pm, ...

We make the perl-related part of the Makefile available from directories
other than the toplevel so that:

* Developers can include it, to avoid code duplication

* Users can get a consistent behavior of "make install"

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
perl.mak: introduce $(GIT_ROOT_DIR) to allow inclusion from other directories

perl.mak uses relative path, which is OK when called from the toplevel,
but won't be anymore if one includes it from elsewhere. It is now
possible to include the file using:

GIT_ROOT_DIR=<whatever>
include $(GIT_ROOT_DIR)/perl.mak

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Use __VA_ARGS__ for all of error's arguments

QNX 6.3.2 uses GCC 2.95.3 by default, and GCC 2.95.3 doesn't remove the
comma if the error macro's variable argument is left out.

Instead of testing for a sufficiently recent version of GCC, make
__VA_ARGS__ match all of the arguments.

Signed-off-by: Matt Kraai <matt.kraai@amo.abbott.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile: make script-related rules usable from subdirectories

Git's Makefile provides a few nice features for script build and
installation (substitute the first line with the right path, hardcode the
path to Git library, ...).

The Makefile already knows how to process files outside the toplevel
directory with e.g.

  make SCRIPT_PERL=path/to/file.perl path/to/file

but we can make it simpler for callers by exposing build, install and
clean rules as .PHONY targets.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-remote-mediawiki: use toplevel's Makefile

This makes the Makefile simpler, while providing more features, and more
consistency (the exact same rules with the exact same configuration as
Git official commands are applied with the new version).

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
user-manual: Update for receive.denyCurrentBranch=refuse

acd2a45 (Refuse updating the current branch in a non-bare repository
via push, 2009-02-11) changed the default to refuse such a push, but
it forgot to update the docs.

7d182f5 (Documentation: receive.denyCurrentBranch defaults to
'refuse', 2010-03-17) updated Documentation/config.txt, but forgot to
update the user manual.

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
user-manual: Rewrite git-gc section for automatic packing

This should have happened back in 2007, when `git gc` learned about
auto:

  commit e9831e83e063844b90cf9e525d0003715dd8b395
  Author: Junio C Hamano <gitster@pobox.com>
  Date:   Mon Sep 17 00:39:52 2007 -0700

    git-gc --auto: add documentation.

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-mergetool: print filename when it contains %

if git-mergetool was invoked with files with a percent sign (%) in
their names, it would print an error.

For example, if you were calling mergetool on a file called "%2F":

    printf: %2F: invalid directive

Do not pass random string to printf as if it is a valid format.  Use
format string "%s" and pass it as a data to be formatted instead.

Signed-off-by: Asheesh Laroia <asheesh@asheesh.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-count-objects.txt: describe each line in -v output

The current description requires a bit of guessing (what clause
corresponds to what printed line?) and lacks information, such as
the unit of size and size-pack.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
count-objects: report garbage files in pack directory too

prepare_packed_git_one() is modified to allow count-objects to hook a
report function to so we don't need to duplicate the pack searching
logic in count-objects.c. When report_pack_garbage is NULL, the
overhead is insignificant.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'al/mergetool-printf-fix' into pu

* al/mergetool-printf-fix:
  git-mergetool: print filename when it contains %
Merge branch 'jk/error-const-return' into pu

* jk/error-const-return:
  Use __VA_ARGS__ for all of error's arguments

Conflicts:
	git-compat-util.h
Merge branch 'mm/allow-contrib-build' into pu

* mm/allow-contrib-build:
  perl.mak: introduce $(GIT_ROOT_DIR) to allow inclusion from other directories
  Makefile: extract perl-related rules to make them available from other dirs
Merge branch 'mm/remote-mediawiki-build' into pu

* mm/remote-mediawiki-build:
  git-remote-mediawiki: use toplevel's Makefile
  Makefile: make script-related rules usable from subdirectories
Merge branch 'nd/count-garbage' into pu

* nd/count-garbage:
  count-objects: report garbage files in pack directory too
  git-count-objects.txt: describe each line in -v output
Merge branch 'wk/gc-auto-is-available-these-days' into pu

* wk/gc-auto-is-available-these-days:
  user-manual: Rewrite git-gc section for automatic packing
Merge branch 'wk/man-deny-current-branch-is-default-these-days' into pu

* wk/man-deny-current-branch-is-default-these-days:
  user-manual: Update for receive.denyCurrentBranch=refuse