git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Kyle J. McKay" <mackyle@gmail.com>
Cc: git@vger.kernel.org, "David Aguilar" <davvid@gmail.com>,
	"Petr Baudis" <pasky@ucw.cz>,
	"Richard Hartmann" <richih.mailinglist@gmail.com>,
	"Jeff King" <peff@peff.net>,
	"Daniel Knittl-Frank" <knittl89@googlemail.com>,
	"Jan Krüger" <jk@jk.gs>, "Alejandro Mery" <amery@geeks.cl>,
	"Aaron Schrab" <aaron@schrab.com>,
	"Eric Sunshine" <sunshine@sunshineco.com>
Subject: Re: [PATCH v8 4/4] config: allow http.<url>.* any user matching
Date: Mon, 22 Jul 2013 11:00:01 -0700	[thread overview]
Message-ID: <7vehaqcw66.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <7dfaadb69accede33b88ae2d9e47a48@f74d39fa044aa309eaea14b9f57fe79> (Kyle J. McKay's message of "Mon, 22 Jul 2013 05:56:44 -0700")

"Kyle J. McKay" <mackyle@gmail.com> writes:

> Previously the <url> had to specify an exactly matching user name
> and password if those were present in the url being matched against.
>
> Now the password portion is always ignored and omitting the user
> name from <url> allows it to match against any user name.
>
> Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
> ---
>  Documentation/config.txt |  29 +++--

Thanks.

> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index e461f32..c418adf 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -1517,15 +1517,26 @@ 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).  Longer <url>
> +	path matches take precedence over shorter matches no matter what order
> +	they occur in.  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.

A solid wall of text is somewhat hard to read, so I'd queue the
equivalent of the following "git diff -w" output on top.  I also was
trying to see if we can clarify the "length comparison" only refers
to the length of the path part, excluding the length of "user@"
(i.e. when comparing "https://user@example.com/path" with
"https://example.com/path", they are of the same length), which you
can see in the first three lines below.

diff --git a/Documentation/config.txt b/Documentation/config.txt
index c418adf..635ed5d 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1521,9 +1521,11 @@ http.<url>.*::
 	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).  Longer <url>
-	path matches take precedence over shorter matches no matter what order
-	they occur in.  For example, if both "https://user@example.com/path" and
+	password part, if present in the url, is always ignored).  A <url>
+	with longer path matches take precedence over shorter matches no matter
+	what order they occur in the configuration file.
++
+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

I am not yet convinced that the precedence rule specified in this
what we want (I do not have an example why it is *not* what we want,
either).  Another definition could be "if user@ is present in the
request, give lower precedence to config entries for the site
without user@ than entries with user@", and I do not have a strong
opinion myself which one between the two is better (and there may be
third and other possible rule).

Comments?

  reply	other threads:[~2013-07-22 18:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-22 12:56 [PATCH v8 0/4] config: add support for http.<url>.* settings Kyle J. McKay
2013-07-22 12:56 ` [PATCH v8 1/4] " Kyle J. McKay
2013-07-24  7:12   ` Jeff King
2013-07-22 12:56 ` [PATCH v8 2/4] config: improve " Kyle J. McKay
2013-07-22 12:56 ` [PATCH v8 3/4] tests: add new test for the url_normalize function Kyle J. McKay
2013-07-24  6:59   ` Jeff King
2013-07-24 17:14     ` Junio C Hamano
2013-07-24 18:43       ` Kyle J. McKay
2013-07-24 19:01     ` Kyle J. McKay
2013-07-24 19:03       ` Jeff King
2013-07-22 12:56 ` [PATCH v8 4/4] config: allow http.<url>.* any user matching Kyle J. McKay
2013-07-22 18:00   ` Junio C Hamano [this message]
2013-07-22 20:24     ` Kyle J. McKay
2013-07-22 21:51       ` Junio C Hamano
2013-07-22 22:18         ` Kyle J. McKay
2013-07-22 22:34           ` Junio C Hamano
2013-07-24  6:42       ` Jeff King
2013-07-24 15:00         ` Junio C Hamano
2013-07-24  6:44   ` Jeff King

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=7vehaqcw66.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=aaron@schrab.com \
    --cc=amery@geeks.cl \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jk@jk.gs \
    --cc=knittl89@googlemail.com \
    --cc=mackyle@gmail.com \
    --cc=pasky@ucw.cz \
    --cc=peff@peff.net \
    --cc=richih.mailinglist@gmail.com \
    --cc=sunshine@sunshineco.com \
    /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).