So here is a bit of refactoring to extract the logic to find the
entry $section.<urlpattern>.$key from the configuration that best
matches the given $url to answer "what value $section.$key should be
for $url?" out of http.c (primarily because we never want to link
"git cofnig" with the cURL library), and use it from "git config" to
implement Peff's idea to extend "git config".

The first step is a pure code movement, plus some renaming of the
functions.

The second step is to factor out the code to handle --bool, --int, etc.
as a helper so that the new codepath can use it.

The last step currently duplicates the logic in http_options(), but
we might want to refactor it further so that the two functions can
share more code.  We hopefully can get rid of test-url-normalize and
instead use "git config --get-urlmatch" in the tests that protect
the http.<url>.config topic.

Junio C Hamano (3):
  url-match: split out URL matching logic out of http.c
  builtin/config: refactor collect_config()
  config: --get-urlmatch

 Makefile             |   2 +
 builtin/config.c     | 183 ++++++++++++++++---
 http.c               | 500 +--------------------------------------------------
 test-url-normalize.c |   2 -
 url-match.c          | 468 +++++++++++++++++++++++++++++++++++++++++++++++
 url-match.h          |  35 ++++
 6 files changed, 671 insertions(+), 519 deletions(-)
 create mode 100644 url-match.c
 create mode 100644 url-match.h

-- 
1.8.4-rc0-137-g17832d4

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to