config: parse http.<url>.<variable> using urlmatch

Use the urlmatch_config_entry() to wrap the underlying
http_options() two-level variable parser in order to set
http.<variable> to the value with the most specific URL in the
configuration.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/config: refactor collect_config()

In order to reuse the logic to format the configuration value while
honouring the requested type, split this function into two.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
config: "git config --get-urlmatch" parses section.<url>.key

Using the same urlmatch_config_entry() infrastructure, add a new
mode "--get-urlmatch" to the "git config" command, to learn values
for the "virtual" two-level variables customized for the specific
URL.

    git config [--<type>] --get-urlmatch <section>[.<key>] <url>

With <section>.<key> fully specified, the configuration data for
<section>.<urlpattern>.<key> for <urlpattern> that best matches the
given <url> is sought (and if not found, <section>.<key> is used)
and reported.  For example, with this configuration:

    [http]
        sslVerify
    [http "https://weak.example.com"]
        cookieFile = /tmp/cookie.txt
        sslVerify = false

You would get

    $ git config --bool --get-urlmatch http.sslVerify https://good.example.com
    true
    $ git config --bool --get-urlmatch http.sslVerify https://weak.example.com
    false

With only <section> specified, you can get a list of all variables
in the section with their values that apply to the given URL.  E.g

    $ git config --get-urlmatch http https://weak.example.com
    http.cookiefile /tmp/cookie.txt
    http.sslverify false

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'jc/url-match' into jch

Reroll of km/http-curl-config-per-url topic.  Peff raises many good
points about the tests for http.* variables.

* jc/url-match:
  config: "git config --get-urlmatch" parses section.<url>.key
  builtin/config: refactor collect_config()
  config: parse http.<url>.<variable> using urlmatch
  config: add generic callback wrapper to parse section.<url>.key
  config: add helper to normalize and match URLs
  http.c: fix parsing of http.sslCertPasswordProtected variable
Merge branch 'tr/log-full-diff-keep-true-parents' into jch

Output from "git log --full-diff -- <pathspec>" looked strange,
because comparison was done with the previous ancestor that touched
the specified <pathspec>, causing the patches for paths outside the
pathspec to show more than the single commit has changed.

Tweak "git reflog -p" for the same reason using the same mechanism.

* tr/log-full-diff-keep-true-parents:
  log: use true parents for diff when walking reflogs
  log: use true parents for diff even when rewriting
Merge branch 'bc/unuse-packfile' into jch

* bc/unuse-packfile:
  Don't close pack fd when free'ing pack windows
  sha1_file: introduce close_one_pack() to close packs on fd pressure
Merge branch 'es/blame-L-more' into jch

More fixes to the code to parse the "-L" option in "log" and "blame".

* es/blame-L-more:
  blame: reject empty ranges -L,+0 and -L,-0
  t8001/t8002: blame: demonstrate acceptance of bogus -L,+0 and -L,-0
  blame: reject empty ranges -LX,+0 and -LX,-0
  t8001/t8002: blame: demonstrate acceptance of bogus -LX,+0 and -LX,-0
  log: fix -L bounds checking bug
  t4211: retire soon-to-be unimplementable tests
  t4211: log: demonstrate -L bounds checking bug
  blame: fix -L bounds checking bug
  t8001/t8002: blame: add empty file & partial-line tests
  t8001/t8002: blame: demonstrate -L bounds checking bug
  t8001/t8002: blame: decompose overly-large test
Merge branch 'jn/post-receive-utf8' into jch

Update post-receive-email script to make sure the message contents
and pathnames are encoded consistently in UTF-8.

I have a feeling that it is a lost cause to solve the issue the
topic tries to address in general, because the patch text can have
payload in any encodings that are different from either the
pathnames or the log message.  Patches that touch paths that use an
encoding that conflicts with the encoding of the payload and/or the
log message could be transferred with core.quotepath set and patch
generated as all binary, but that would be pretty much useless.

* jn/post-receive-utf8:
  hooks/post-receive-email: set declared encoding to utf-8
  hooks/post-receive-email: force log messages in UTF-8
  hooks/post-receive-email: use plumbing instead of git log/show
### 2.0
Merge branch 'jc/push-2.0-default-to-simple' into jch

* jc/push-2.0-default-to-simple:
  push: switch default from "matching" to "simple"

# Conflicts:
# 	Documentation/config.txt
# 	Documentation/git-push.txt
# 	builtin/push.c
Merge branch 'jn/add-2.0-u-A-sans-pathspec' into jch

* jn/add-2.0-u-A-sans-pathspec:
  git add: -u/-A now affects the entire working tree

# Conflicts:
# 	builtin/add.c
Merge branch 'jc/add-2.0-ignore-removal' into jch

Updated endgame for "git add <pathspec>" that defaults to "--all"
aka "--no-ignore-removal".

* jc/add-2.0-ignore-removal:
  git add <pathspec>... defaults to "-A"

# Conflicts:
# 	builtin/add.c
Merge branch 'jc/core-checkstat-2.0' into jch

* jc/core-checkstat-2.0:
  core.statinfo: remove as promised in Git 2.0
Merge branch 'jc/hold-diff-remove-q-synonym-for-no-deletion' into jch

* jc/hold-diff-remove-q-synonym-for-no-deletion:
  diff: remove "diff-files -q" in a version of Git in a distant future

# Conflicts:
# 	diff.c
Merge branch 'jc/reflog-doc' into pu

Document rules to use GIT_REFLOG_ACTION variable in the scripted
Porcelain.  git-rebase--interactive locally violates this, but it
is a leaf user that does not call out to or dot-sources other
scripts, so fixing it is not all that urgent.

* jc/reflog-doc:
  setup_reflog_action: document the rules for using GIT_REFLOG_ACTION

# Conflicts:
# 	Documentation/git.txt
Merge branch 'tf/gitweb-ss-tweak' into pu

Comments?

* tf/gitweb-ss-tweak:
  gitweb: make search help link less ugly
  gitweb: omit the repository owner when it is unset
  gitweb: vertically centre contents of page footer
  gitweb: ensure OPML text fits inside its box
Merge branch 'mg/more-textconv' into pu

Make "git grep" and "git show" pay attention to --textconv when
dealing with blob objects.

I thought this was pretty well designed and executed, but it seems
there are some doubts on the list; kicked back to 'pu'.

* mg/more-textconv:
  grep: honor --textconv for the case rev:path
  grep: allow to use textconv filters
  t7008: demonstrate behavior of grep with textconv
  cat-file: do not die on --textconv without textconv filters
  show: honor --textconv for blobs
  diff_opt: track whether flags have been set explicitly
  t4030: demonstrate behavior of show with textconv

# Conflicts:
# 	diff.h
# 	object.c
# 	object.h
# 	t/t8007-cat-file-textconv.sh
Merge branch 'jh/shorten-refname' into pu

When remotes/origin/HEAD is not a symbolic ref, "rev-parse
--abbrev-ref remotes/origin/HEAD" ought to show "origin", not
"origin/HEAD", which is fixed with this series (if it is a symbolic
ref that points at remotes/origin/something, then it should show
"origin/something" and it already does).

$gmane/225137

* jh/shorten-refname:
  t1514: refname shortening is done after dereferencing symbolic refs
  shorten_unambiguous_ref(): Fix shortening refs/remotes/origin/HEAD to origin
  t1514: Demonstrate failure to correctly shorten "refs/remotes/origin/HEAD"
  t1514: Add tests of shortening refnames in strict/loose mode

# Conflicts:
# 	refs.c
Merge branch 'jk/gitweb-utf8' into pu

Various fixes to gitweb.

Drew Northup volunteered to take a look into this.
$gmane/226216

* jk/gitweb-utf8:
  gitweb: Fix broken blob action parameters on blob/commitdiff pages
  gitweb: Don't append ';js=(0|1)' to external links
  gitweb: Make feed title valid utf8
  gitweb: Fix utf8 encoding for blob_plain, blobdiff_plain, commitdiff_plain, and patch
Merge branch 'jc/format-patch' into pu

A new option to send a single patch to the standard output to be
appended at the bottom of a message.  I personally have no need for
this, but it was easy enough to cobble together.  Tests, docs and
stripping out more MIMEy stuff are left as exercises to interested
parties.

tying its loose ends.

* jc/format-patch:
  format-patch: --inline-single
  format-patch: rename "no_inline" field

# Conflicts:
# 	log-tree.c
# 	pretty.c