t3310: illustrate failure to "notes merge --commit" inside $GIT_DIR/

The 'git notes merge' command expected to be run from the working
tree of the project being annotated, and did not anticipate getting
run inside $GIT_DIR/.

However, because we use $GIT_DIR/NOTES_MERGE_WORKTREE as a temporary
working space for the user to work on resolving conflicts, it is not
unreasonable for a user to run "git notes merge --commit" there. But
the command fails to do so.

Found-by: David Bremner <david@tethera.net>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
notes-merge: use opendir/readdir instead of using read_directory()

notes_merge_commit() only needs to list all entries (non-recursively)
under a directory, which can be easily accomplished with
opendir/readdir and would be more lightweight than read_directory().

read_directory() is designed to list paths inside a working
directory. Using it outside of its scope may lead to undesired effects.

Apparently, one of the undesired effects of read_directory() is that it
doesn't deal with being given absolute paths. This creates problems for
notes_merge_commit() when git_path() returns an absolute path, which
happens when the current working directory is in a subdirectory of the
.git directory.

Originally-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Updated-by:  Johan Herland <johan@herland.net>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http: try http_proxy env var when http.proxy config option is not set

cURL already reads it, but if $http_proxy has username but no password
cURL will not ask you for the password and so failed to authenticate
returning a 407 error code. So we read it ourselves to detect that and
ask for the password. Also we read it prior to connection to be able to
make a proactive authentication in case the flag http_proactive_auth is
set.

Signed-off-by: Nelson Benitez Leon <nbenitezl@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http: handle proxy proactive authentication

If http_proactive_auth flag is set and there is a username
but no password in the proxy url, then interactively ask for
the password.

This makes possible to not have the password written down in
http_proxy env var or in http.proxy config option.

Also take care that CURLOPT_PROXY don't include username or
password, as we now set them in the new set_proxy_auth() function
where we use their specific cURL options.

Signed-off-by: Nelson Benitez Leon <nbenitezl@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http: handle proxy authentication failure (error 407)

Handle http 407 error code by asking for credentials and
retrying request in case credentials were not present, or
marking credentials as rejected if they were already provided.

Signed-off-by: Nelson Benitez Leon <nbenitezl@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http: Avoid limit of retrying request only twice

Current code, after receiving HTTP_REAUTH, only retried
once, so couldn't do step 3 of the following sequence:

  1. We make a request; proxy returns 407, because we didn't give it a
     password. We ask for the password and return HTTP_REAUTH.

  2. We make another request; the proxy passes it to the actual server,
     who returns 401, because we didn't give an http password. We ask
     for the password and return HTTP_REAUTH.

  3. We make a third request, but this time everybody is happy.

Now we retry as long as we keep receiving HTTP_REAUTH, so the previous
sequence correctly completes.

Patch by Jeff King <peff@peff.net>

Signed-off-by: Nelson Benitez Leon <nbenitezl@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'jc/fmt-merge-msg-people' into jch

The "fmt-merge-msg" command learns to list the primary contributors
involved in the side topic you are merging.

Will defer til 1.7.10.

By Junio C Hamano
* jc/fmt-merge-msg-people:
  fmt-merge-msg.c: make util_as_int() return "int"
  fmt-merge-msg: finishing touches
  fmt-merge-msg: show those involved in a merged series
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.

By Nguyễn Thái Ngọc Duy (6) and Junio C Hamano (1)
* 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.

By René Scharfe
* rs/unpack-trees-leakfix:
  unpack-trees: plug minor memory leak
Merge branch 'ph/rerere-doc' into jch

Will merge to 'master' by 1.7.10.

By Phil Hord
* ph/rerere-doc:
  rerere: Document 'rerere remaining'
Merge branch 'jc/maint-undefined-i18n-observation-test' into jch

It was unclear what a test in t0204 wanted to check; it turns out
that it was only to observe an undefined behaviour of the system,
and did not anticipate one kind of reasonable error behaviour.

Replaces the tb/maint-remove-irrelevant-i18n-test topic.

We may want merge this before 1.7.10 to help Mac OS X builders.

By Junio C Hamano
* jc/maint-undefined-i18n-observation-test:
  t0204: clarify the "observe undefined behaviour" test
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.

By Junio C Hamano
* 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/i18n-shell-script-gettext' into jch

The auto detection was testing if a fixed string that is known to be
non-empty is empty by mistake.

By Junio C Hamano
* jc/i18n-shell-script-gettext:
  i18n: fix auto detection of gettext scheme for shell scripts
Merge branch 'ms/maint-config-error-at-eol-linecount' into jch

When "git config" diagnoses an error in a configuration file and
shows the line number for the offending line, it miscounted if the
error was at the end of line.

By Martin Stenberg
* ms/maint-config-error-at-eol-linecount:
  config: report errors at the EOL with correct line number

Conflicts:
	t/t1300-repo-config.sh
Merge branch 'dg/test-from-elsewhere' into pu

Better support for out-of-tree test scripts, but it appears that the
approach needs to be rethought.  By repointing TEST_DIRECTORY to a
directory other than $(pwd)/.., an out of place test script can reach
test helpers and freshly built Git relative to it (GIT_BUILD_DIR is
a mere short-hand for $TEST_DIRECTORY/..).

By David A. Greene
* dg/test-from-elsewhere:
  Support out-of-tree Valgrind tests
  Allow overriding GIT_BUILD_DIR
Merge branch 'nl/http-proxy-more' into pu

The code to talk to http proxies learn to use the same credential
API used to talk to the final http destinations.

Will defer til 1.7.10.

By Nelson Benitez Leon
* nl/http-proxy-more:
  http: Avoid limit of retrying request only twice
  http: handle proxy authentication failure (error 407)
  http: handle proxy proactive authentication
  http: try http_proxy env var when http.proxy config option is not set
Merge branch 'jc/advise-push-default' into pu

Peff had a good suggestion outlining an updated code structure so
that somebody new can try to dip his or her toes in the development.
Any takers?

By Junio C Hamano
* jc/advise-push-default:
  push: hint to use push.default=upstream when appropriate
Merge branch 'ss/git-svn-prompt-sans-terminal' into pu

The bottom one has been replaced with a rewrite based on comments
from Ævar. The second one needs more work, both in perl/Git.pm and
prompt.c, to give precedence to tty over SSH_ASKPASS when terminal
is available.

By Sven Strickroth (2) and Junio C Hamano (1)
* ss/git-svn-prompt-sans-terminal:
  fixup! 15eaaf4
  git-svn, perl/Git.pm: extend Git::prompt helper for querying users
  perl/Git.pm: "prompt" helper to honor GIT_ASKPASS and SSH_ASKPASS
Merge branch 'hv/submodule-recurse-push' into pu

The bottom one was not clearly explained and needs a reroll.

By Heiko Voigt
* hv/submodule-recurse-push:
  push: teach --recurse-submodules the on-demand option
  Refactor submodule push check to use string list instead of integer
  Teach revision walking machinery to walk multiple times sequencially

Conflicts:
	transport.h
Merge branch 'nd/columns' into pu

Rerolled; the configuration handling looked iffy, but otherwise well
explained.

By Nguyễn Thái Ngọc Duy
* nd/columns:
  tag: add --column
  column: support piping stdout to external git-column process
  status: add --column
  branch: add --column
  help: reuse print_columns() for help -a
  column: add column.ui for default column output settings
  column: add dense layout support
  column: add columnar layout
  Stop starting pager recursively
  Add git-column for columnar display