git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: "Kyle J. McKay" <mackyle@gmail.com>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	git@vger.kernel.org, "David Aguilar" <davvid@gmail.com>,
	"Petr Baudis" <pasky@ucw.cz>,
	"Richard Hartmann" <richih.mailinglist@gmail.com>,
	"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: Wed, 24 Jul 2013 02:42:59 -0400	[thread overview]
Message-ID: <20130724064258.GA30074@sigill.intra.peff.net> (raw)
In-Reply-To: <DF5B20F8-33C2-4F72-A78B-97EE1FB4A522@gmail.com>

On Mon, Jul 22, 2013 at 01:24:06PM -0700, Kyle J. McKay wrote:

> >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?
> 
> Consider this site:
> [...]

Thanks for explaining, and sorry I missed out on the last few rounds of
review.

I think your scheme (normalization plus special handling of the username
field) addresses my biggest concern, which is matching in the face of
optional usernames. The only two things that make me wary are:

  1. The explanation and special-casing of username is a little
     complicated to explain.

  2. The behavior for resolving the value when faced with multiple
     possibilities is completely unlike the rest of the config system
     (both dropping last-one-wins, and unlike the URL matching for
     credentials).

I think we can decide that (2) is worth it if your semantics are more
flexible in practice. It would be nice to see real-world feedback on how
people use it before setting the behavior in stone, but there's sort of
a chicken and egg problem there.

For (1), I wonder if the explanation would be simpler if the precedences
of each sub-part were simply laid out. That is, would it be correct to
say something like:

  For a config key to match a URL, each element of the config key (if
  present) is compared to that of the URL, in the following order:

    1. Protocol (e.g., `https` in `https://example.com/`). This field
       must match exactly between the config key and the URL.

    2. Host/domain name (e.g., `example.com` in `https://example.com/`).
       This field must match exactly between the config key and the URL.

    3. Path (e.g., `repo.git` in `https://example.com/repo.git`). This
       field is prefix-matched by slash-delimited path elements, so that
       config key `foo/` matches URL `foo/bar`. Longer matches take
       precedence (so `foo/bar`, if it exists, is a better match than
       just `foo/`).

    4. Username (e.g., `user` in `https://user@example.com/repo.git`).

  The list above is ordered by decreasing precedence; a URL that matches
  a config key's path is preferred to one that matches its username.

I don't know if that is more or less clear of an explanation. It makes
more sense to me, but that is probably because I wrote it. I'm also not
100% sure it describes your implementation, but I think it is equivalent
to the prefix matching with normalization.

I have a few other comments on specific patches; I'll send them
separately.

-Peff

  parent reply	other threads:[~2013-07-24  6:43 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
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 [this message]
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=20130724064258.GA30074@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=aaron@schrab.com \
    --cc=amery@geeks.cl \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jk@jk.gs \
    --cc=knittl89@googlemail.com \
    --cc=mackyle@gmail.com \
    --cc=pasky@ucw.cz \
    --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).