checkout: suppress tracking message with "-q"

Like the "switched to..." message (which is already
suppressed by "-q"), this message is purely informational.
Let's silence it if the user asked us to be quiet.

This patch is slightly more than a one-liner, because we
have to teach create_branch to propagate the flag all the
way down to install_branch_config.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
teach "git branch" a --quiet option

There's currently no way to suppress the informational
"deleted branch..." or "set up tracking..." messages.  This
patch provides a "-q" option to do so.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
run-command: propagate EACCES errors to parent

The caller of run_command does not directly get access to
the errno from exec, because it happens in the forked child.
However, knowing the specific reason for an exec failure can
help the parent respond better or produce better error
messages.

We already propagate ENOENT to the parent via exit code 127.
Let's do the same for EACCES with exit code 126, which is
already used by bash to indicate the same thing.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git: continue alias lookup on EACCES errors

If git receives an EACCES error while trying to execute an
external command, we currently give up and report the error.
However, the EACCES may be caused by an inaccessible
directory in the user's PATH.

In this case, execvp will skip over the inaccessible
directory and keep searching the PATH. If it finds
something, then that gets executed. Otherwise, the earlier
EACCES is remembered and returned.

However, git does not implement the same rule when looking
up aliases. It will return immediately upon seeing EACCES
from execvp, without trying aliases.  This renders aliases
unusable if there is an inaccessible directory in the PATH.

This patch implements a logical extension of execvp's lookup
rules to aliases. We will try to find aliases even after
execvp returns EACCES. If there is an alias, then we expand
it as usual.  If ther eisn't, then we will remember and
report the EACCES error.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
[DONTMERGE] semi-squashable test addition
apply: rename free_patch() to free_patch_list()

As that is the only logical name for a function that walks a list
and frees each element on it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
apply: free patch->{def,old,new}_name fields

These were all allocated in the heap by parsing the header parts of the
patch, but we did not bother to free them.  Some used to share the memory
(e.g. copying def_name to old_name) so this is not just the matter of
adding three calls to free().

Signed-off-by: Junio C Hamano <gitster@pobox.com>
apply: release memory for fn_table

The fn_table is used to record the result of earlier patch application in
case a hand-crafted input file contains multiple patches to the same file.
Both its string key (filename) and the contents are borrowed from "struct
patch" that represents the previous application in the same apply_patch()
call, and they do not leak, but the table itself was not freed properly.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
apply: free patch->result

This is by far the largest piece of data, much larger than the patch and
fragment structures or the three name fields in the patch structure.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
apply.c: WIP ownership audit

Add a few comments on ownership, and tighten constness of a few line
buffer variables.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'nd/stream-more' into jch

Use API to read blob data in smaller chunks in more places to
reduce the memory footprint.  In general, looked fairly good.

Will defer til 1.7.10.

* nd/stream-more:
  update-server-info: respect core.bigfilethreshold
  fsck: use streaming API for writing lost-found blobs
  show: use streaming API for showing blobs
  parse_object: avoid putting whole blob in core
  cat-file: use streaming API to print blobs
  Add more large blob test cases
  streaming: make streaming-write-entry to be more reusable
Merge branch 'rs/unpack-trees-leakfix' into jch

Will defer til 1.7.10.

* rs/unpack-trees-leakfix:
  unpack-trees: plug minor memory leak
Merge branch 'jc/commit-hook-authorship' into jch

"git commit --author=$name" did not tell the name that was being
recorded in the resulting commit to hooks, even though it does do so
when the end user overrode the authorship via the "GIT_AUTHOR_NAME"
environment variable.  This is a simpler of the two approaches.

Will defer til 1.7.10.

* jc/commit-hook-authorship:
  commit: pass author/committer info to hooks
  t7503: does pre-commit-hook learn authorship?
  ident.c: add split_ident_line() to parse formatted ident line
Merge branch 'jc/diff-algo-cleanup' into jch

Resurrects the preparatory clean-up patches from another topic that was
discarded, as this would give a saner foundation to build on diff.algo
configuration option series.

Not urgent.

* jc/diff-algo-cleanup:
  xdiff: PATIENCE/HISTOGRAM are not independent option bits
  xdiff: remove XDL_PATCH_* macros
Merge branch 'da/difftool-test' into jch

Makes sure "difftool" options can be given in any order.

* da/difftool-test:
  t7800: Test difftool passing arguments to diff
Merge branch 'jn/diffstat-tests' into jch

Some tests checked the "diff --stat" output when they do not have to,
which unnecessarily made things harder to verify under GETTEXT_POISON.

Not urgent.

* jn/diffstat-tests:
  diffstat summary line varies by locale: miscellany
  test: use numstat instead of diffstat in binary-diff test
  test: use --numstat instead of --stat in "git stash show" tests
  test: test cherry-pick functionality and output separately
  test: modernize funny-names test style
  test: use numstat instead of diffstat in funny-names test
  test: use test_i18ncmp when checking --stat output
Merge branch 'tr/maint-word-diff-regex-sticky' into jch

The regexp configured with wordregex was incorrectly reused across
files.
Not urgent.

* tr/maint-word-diff-regex-sticky:
  diff: tweak a _copy_ of diff_options with word-diff
  diff: refactor the word-diff setup from builtin_diff_cmd
  t4034: diff.*.wordregex should not be "sticky" in --word-diff
Merge branch 'jh/notes-merge-in-git-dir-worktree' into jch

Running "notes merge --commit" failed to perform correctly when run
from any directory inside $GIT_DIR/.  When "notes merge" stops with
conflicts, $GIT_DIR/NOTES_MERGE_WORKTREE is the place a user edits
to resolve it.

Not urgent.

* jh/notes-merge-in-git-dir-worktree:
  notes-merge: Don't remove .git/NOTES_MERGE_WORKTREE; it may be the user's cwd
  notes-merge: use opendir/readdir instead of using read_directory()
  t3310: illustrate failure to "notes merge --commit" inside $GIT_DIR/
  remove_dir_recursively(): Add flag for skipping removal of toplevel dir
Merge branch 'jc/maint-clean-nested-worktree-in-subdir' into jch

"git clean -d -f" (not "-d -f -f") is supposed to protect nested working
trees of independent git repositories that exist in the current project
working tree from getting removed, but the protection applied only to such
working trees that are at the top-level of the current project by mistake.

Not urgent.

* jc/maint-clean-nested-worktree-in-subdir:
  clean: preserve nested git worktree in subdirectories
Merge branch 'zj/test-cred-helper-nicer-prove' into jch

Minor improvement to t0303.
Not urgent.

* zj/test-cred-helper-nicer-prove:
  t0303: resurrect commit message as test documentation
  t0303: immediately bail out w/o GIT_TEST_CREDENTIAL_HELPER