sha1_file: reorder code in prepare_packed_git_one()

The current loop does

	while (...) {
		if (it is not an .idx file)
			continue;
		process .idx file;
	}

and is reordered to

	while (...) {
		if (it is an .idx file) {
			process .idx file;
		}
	}

This makes it easier to add new extension file processing.

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.

The garbage is reported with warning() instead of error() in packed
garbage case because it's not an error to have garbage. Loose garbage
is still reported as errors and will be converted to warnings later.

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 how much disk space taken by garbage files

Also issue warnings on loose garbages instead of errors as a result of
using report_garbage() function in count_objects()

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gpg-interface: check good signature in a reliable way

Currently, verify_signed_buffer() only checks the return code of gpg,
and some callers implement additional unreliable checks for "Good
signature" in the gpg output meant for the user.

Use the status output instead and parse for a line beinning with
"[GNUPG:] GOODSIG ". This is the only reliable way of checking for a
good gpg signature.

If needed we can change this easily to "[GNUPG:] VALIDSIG " if we want
to take into account the trust model.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
log-tree: rely upon the check in the gpg_interface

It's just so much clearer.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gpg_interface: allow to request status return

Currently, verify_signed_buffer() returns the user facing output only.

Allow callers to request the status output also.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pretty: parse the gpg status lines rather than the output

Currently, parse_signature_lines() parses the gpg output for strings
which depend on LANG so it fails to recognize good commit signatures
(and thus does not fill in %G? and the like) in most locales.

Make it parse the status lines from gpg instead, which are the proper
machine interface. This fixes the problem described above.

There is a change in behavior for "%GS" which we intentionally do not
work around: "%GS" used to put quotes around the signer's uid (or
rather: it inherited from the gpg user output). We output the uid
without quotes now, just like author and committer names.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pretty: make %GK output the signing key for signed commits

In order to employ signed keys in an automated way it is absolutely
necessary to check which keys the signatures come from.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git.txt: update description of the configuration mechanism

The old Git version where it appeared is now useful only to historians,
not to normal users. Also, the text was mentioning only the per-repo
config file, so add a mention of ~/.gitconfig. Describing in details the
system-wide, XDG and all would be counter-productive here, so reword the
description of the link to git-config to make it clear that it is not
only a list of configuration options.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'da/p4merge-mktemp-fix' into jch

Will merge to 'next'.

* da/p4merge-mktemp-fix:
  p4merge: fix printf usage
Merge branch 'jk/read-commit-buffer-data-after-free' into jch

Will merge to 'next'.

* jk/read-commit-buffer-data-after-free:
  log: re-encode commit messages before grepping
Merge branch 'mk/old-expat' into jch

Will merge to 'next'.

* mk/old-expat:
  Allow building with xmlparse.h
Merge branch 'ef/non-ascii-parse-options-error-diag' into jch

Will merge to 'next'.

* ef/non-ascii-parse-options-error-diag:
  parse-options: report uncorrupted multi-byte options
Merge branch 'jk/rebase-i-comment-char' into jch

Will merge to 'next'.

* jk/rebase-i-comment-char:
  rebase -i: respect core.commentchar
Merge branch 'mm/config-local-completion' into jch

Will merge to 'next'.

* mm/config-local-completion:
  completion: support 'git config --local'
Merge branch 'mk/make-rm-depdirs-could-be-empty' into jch

"make COMPUTE_HEADER_DEPENDENCIES=no clean" would try to run "rm
-rf $(dep_dirs)" with an empty dep_dir, but some implementations of
"rm -rf" barf on an empty argument list.

Will merge to 'next'.

* mk/make-rm-depdirs-could-be-empty:
  Makefile: don't run "rm" without any files
Merge branch 'mw/bash-prompt-show-untracked-config' into jch

Allows skipping the untracked check GIT_PS1_SHOWUNTRACKEDFILES
asks for the git-prompt (in contrib/) per repository.

Will merge to 'next'.

* mw/bash-prompt-show-untracked-config:
  t9903: add extra tests for bash.showDirtyState
  t9903: add tests for bash.showUntrackedFiles
  shell prompt: add bash.showUntrackedFiles option
Merge branch 'wk/man-deny-current-branch-is-default-these-days' into jch

Will merge to 'next'.

* wk/man-deny-current-branch-is-default-these-days:
  user-manual: Update for receive.denyCurrentBranch=refuse
Merge branch 'mp/diff-algo-config' into jch

Add diff.algorithm configuration so that the user does not type
"diff --histogram".

Looking better; may want tests to protect it from future breakages,
but otherwise it looks ready for 'next'.

Expecting a follow-up to add tests.

* mp/diff-algo-config:
  diff: Introduce --diff-algorithm command line option
  config: Introduce diff.algorithm variable
  git-completion.bash: Autocomplete --minimal and --histogram for git-diff

Conflicts:
	Documentation/diff-config.txt
Merge branch 'jc/hidden-refs' into jch

Allow the server side to redact the refs/ namespace it shows to the
client.

Will merge to 'next'.

* jc/hidden-refs:
  upload/receive-pack: allow hiding ref hierarchies
  upload-pack: simplify request validation
  upload-pack: share more code

Conflicts:
	builtin/receive-pack.c