git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "Kyle J. McKay" <mackyle@gmail.com>, git@vger.kernel.org
Subject: Re: [REQUEST 1/1] docs: update http.<url>.* options documentation
Date: Thu, 25 Jul 2013 22:53:25 -0700	[thread overview]
Message-ID: <7v8v0t50kq.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20130726043748.GA20286@sigill.intra.peff.net> (Jeff King's message of "Fri, 26 Jul 2013 00:37:48 -0400")

Jeff King <peff@peff.net> writes:

> Signed-off-by: Jeff King <peff@peff.net>
>
> You should add your S-O-B, too, for your bits.
> ...
> So this patch looks pretty good to me; the two points I raised above are
> how I would have done it, but they are relatively minor if you do not
> agree.

Will queue the attached, unless you spot glaring errors made by me,
coding while drunk ;-)

-- >8 --
From: "Kyle J. McKay" <mackyle@gmail.com>
Date: Thu, 25 Jul 2013 15:39:13 -0700
Subject: [PATCH] docs: update http.<url>.* options documentation

Overhaul the text of the http.<url>.* options documentation
providing a hopefully easier to understand itemized list of matching
behavior as suggested by and including text from Jeff King.

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>
---
 Documentation/config.txt | 60 +++++++++++++++++++++++++++++-------------------
 1 file changed, 37 insertions(+), 23 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 6b135be..ec852ab 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1515,30 +1515,44 @@ http.useragent::
 
 http.<url>.*::
 	Any of the http.* options above can be applied selectively to some urls.
-	For example "http.https://example.com.useragent" would set the user
-	agent only for https connections to example.com.  The <url> value
-	matches a url if it refers to the same scheme, host and port and the
-	path portion is an exact match or a prefix that matches at a "/"
-	boundary.  If <url> does not include a user name, it will match a url
-	with any username otherwise the user name must match as well (the
-	password part, if present in the url, is always ignored).  A <url>
-	with longer path matches takes precedence over shorter matches no matter
-	what order they occur in the configuration file.
+	For a config key to match a URL, each element of the config key is
+	compared to that of the URL, in the following order:
 +
-For example, if both "https://user@example.com/path" and
-"https://example.com/path/name" are used as a config <url> value and
-then "https://user@example.com/path/name/here" is passed to a git
-command, the settings in the "https://example.com/path/name" section
-will be preferred because that <url> has a longer path length match than
-"https://user@example.com/path" even though the latter did match the
-user.  For same length matches, the last one wins except that a same
-length <url> match that includes a user name will be preferred over a
-same length <url> match that does not.  The urls are normalized before
-matching so that equivalent urls that are simply spelled differently
-will match properly.  Environment variable settings always override any
-matches.  The urls that are matched against are those given directly to
-git commands.  This means any urls visited as a result of a redirection
-do not participate in matching.
+--
+. Scheme (e.g., `https` in `https://example.com/`). This field
+  must match exactly between the config key and the URL.
+. Host/domain name (e.g., `example.com` in `https://example.com/`).
+  This field must match exactly between the config key and the URL.
+. Port number (e.g., `8080` in `http://example.com:8080/`).
+  This field must match exactly between the config key and the URL.
+  Omitted port numbers are automatically converted to the correct
+  default for the scheme before matching.
+. Path (e.g., `repo.git` in `https://example.com/repo.git`). The
+  path field of the config key must match the path field of the URL
+  either exactly or as a prefix of slash-delimited path elements.  This means
+  a config key with path `foo/` matches URL path `foo/bar`.  A prefix can only
+  match on a slash (`/`) boundary.  Longer matches take precedence (so a config
+  key with path `foo/bar` is a better match to URL path `foo/bar` than a config
+  key with just path `foo/`).
+. Exact user name match (e.g., `user` in `https://user@example.com/repo.git`).
+  If the config key has a user name it must match the user name in the URL
+  exactly.
+. Any user name match.  If a config key does not have a user name, that config
+  key will match a URL with any user name (including none).
+--
++
+The list above is ordered by decreasing precedence; a URL that matches
+a config key's path is preferred to one that matches its user name. For example,
+if the URL is `https://user@example.com/foo/bar` a config key match of
+`https://example.com/foo` will be preferred over a config key match of
+`https://user@example.com`.
++
+All URLs are normalized before attempting any matching (the password part,
+if embedded in the URL, is always ignored for matching purposes) so that
+equivalent urls that are simply spelled differently will match properly.
+Environment variable settings always override any matches.  The urls that are
+matched against are those given directly to Git commands.  This means any URLs
+visited as a result of a redirection do not participate in matching.
 
 i18n.commitEncoding::
 	Character encoding the commit messages are stored in; Git itself
-- 
1.8.4-rc0-117-gda13126

  reply	other threads:[~2013-07-26  5:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-25 22:39 [REQUEST 0/1] Requesting your signed-off-by Kyle J. McKay
2013-07-25 22:39 ` [REQUEST 1/1] docs: update http.<url>.* options documentation Kyle J. McKay
2013-07-26  4:37   ` Jeff King
2013-07-26  5:53     ` Junio C Hamano [this message]
2013-07-26  6:07       ` Junio C Hamano
2013-07-26  6:23     ` Kyle J. McKay
2013-07-26 22:27       ` Jeff King
2013-07-27  2:15         ` Kyle J. McKay
2013-07-27  2:43           ` Jeff King
2013-07-27  3:04             ` Kyle J. McKay
2013-07-26  6:42     ` Kyle J. McKay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v8v0t50kq.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=mackyle@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).