git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Peter Wu <peter@lekensteyn.nl>
Cc: git@vger.kernel.org, "Jeff King" <peff@peff.net>,
	"Torsten Bögershausen" <tboegi@web.de>
Subject: Re: [PATCH v4] remote: add --fetch and --both options to set-url
Date: Wed, 17 Dec 2014 14:31:34 -0800	[thread overview]
Message-ID: <xmqqr3vx9ad5.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1418825936-18575-1-git-send-email-peter@lekensteyn.nl> (Peter Wu's message of "Wed, 17 Dec 2014 15:18:56 +0100")

Peter Wu <peter@lekensteyn.nl> writes:

> git remote set-url knew about the '--push' option to update just the
> pushurl, but it does not have a similar option for "update fetch URL and
> leave whatever was in place for the push URL".
>
> This patch adds support for a '--fetch' option which implements that use
> case in a backwards compatible way: if no --both, --push or --fetch
> options are given, then the push URL is modified too if it was not set
> before. This is the case since the push URL is implicitly based on the
> fetch URL.

OK.  In other words, for those without asymmetric configuration
without a need to define pushURL, this default should be the most
convenient, as it does not have to fiddle with two variables.

> A '--both' option is added to make the command independent of previous
> pushurl settings. For the --add and --delete set operations, it will
> always set the push and/ or the fetch URLs. For the primary mode of

"and/or", I think.

> operation (without --add or --delete), it will drop pushurl as the
> implicit push URL is the (fetch) URL.

I think this description is clear enough without "(if exists)" at
the end.

> While '--both' could be implemented as '--fetch --push', it might also
> be mistaken for "--push overrides --fetch". An option such as
> "--only={fetch|push|both}" was also considered, but it is longer than
> the current options, makes --push redundant and brings the confusing
> option "--only=both". Options such as '--direction=...' is too long and
> '--dir=' is ambiguous ("directory"?). Thus, for brevity three new
> options were introduced.

Sounds sensible.

> @@ -134,7 +134,15 @@ Changes URL remote points to. Sets first URL remote points to matching
>  regex <oldurl> (first URL if no <oldurl> is given) to <newurl>. If
>  <oldurl> doesn't match any URL, error occurs and nothing is changed.
>  +
> -With '--push', push URLs are manipulated instead of fetch URLs.
> +With '--both', both the fetch and push URLs are manipulated.
> ++
> +With '--fetch', only fetch URLs are manipulated.
> ++
> +With '--push', only push URLs are manipulated.

I am afraid that this part is confusing when read in the wider
context of the document.

The first sentence of this section (outside the patch) is "Changes
URL remote points to"; I expect that the most people would think
that it is talking about "remote.*.url" configuration, and the
wording for "--push" in the original is also clear that it touches
'remote.*.pushurl' instead.

In the updated text, you use words "fetch URL" and "push URL" to
mean "regardless of how these are represented by the configuration
system, the URL to be used for fetching/pushing".  In other words,
in the updated vocabulary, 'remote.*.pushurl' is *NOT* called "push
URL" (and 'remote.*.url' is not 'fetch URL').

That may be easier for new people who aren't familiar with the
configuration system (read: I am saying that it may be a good idea
in the longer term), but the phrasing does not make it clear that
they are not referring remote.*.{url,pushURL} variables.

Rephrasing these to "URLs used for fetching" vs "URLs used for
pushing" may make things a bit less confusion-prone.

In any case, we would also need to update Documentation/config.txt
which has these:

    remote.<name>.url::
            The URL of a remote repository.  See linkgit:git-fetch[1] or
            linkgit:git-push[1].

    remote.<name>.pushurl::
            The push URL of a remote repository.  See linkgit:git-push[1].

It may be sufficient to rephrase them like so:

    remote.<name>.url::
	The URL of a remote repository, used for fetching from it
        and pushing into it unless a separate remote.<name>.pushURL
        is defined.  See linkgit:git-fetch[1] and linkgit:git-push[1]

    remote.<name>.pushurl::
	The URL of a remote repository, used for pushing into it
        (if undefined, remote.<name>.url is used to push into it).
	See linkgit:git-push[1].

perhaps?

> +For historical reasons, if neither --fetch nor --push is specified then the
> +fetch URL is changed, as well as the push URL if this was not already set. This
> +behavior may change in the future.

This paragraph is unwarranted.  As you explained in the second
paragraph in the log message, the traditional behaviour was a good
default for majority of people and I do not think we saw any
demonstrated need to deprecate it.

> +#define MODIFY_TYPE_FETCH       (1 << 0)
> +#define MODIFY_TYPE_PUSH        (1 << 1)
> +#define MODIFY_TYPE_BOTH        (MODIFY_TYPE_FETCH | MODIFY_TYPE_PUSH)
> +/* The historic behavior behaves like --fetch, but does not touch the push URL
> + * configuration (and thereby may appear to change the push URL too if this was
> + * not set before).
> + */
> +#define MODIFY_TYPE_HISTORIC    (MODIFY_TYPE_FETCH | (1 << 2))

	/*
         * Our multi-line comment begins with a slash-asterisk
         * without anything else on the remainder of the line
         * and ends with an asterisk-slash, possibly indented
         * and nothing else on it.
         */

Perhaps s/HISTORIC/TRADITIONAL/ or s/HISTORIC/LITERAL/ (the latter
is for "literally update 'URL' configuration for the named remote,
don't play with 'do we have pushURL?' games").

> +	/* Make the implicit push URL explicit if the fetch URL is modified,
> +	 * except when in the historic mode (then the pushurl configuration is
> +	 * not changed). */

Likewise.

Thanks.

  parent reply	other threads:[~2014-12-17 22:31 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14 18:41 [PATCH/RFC] Gitweb: Convert UTF-8 encoded file names Michael Wagner
2014-05-14 21:57 ` Junio C Hamano
2014-05-14 22:25   ` Jakub Narębski
2014-05-15  5:08     ` Michael Wagner
2014-05-15  9:04       ` Peter Krefting
2014-05-15 17:24         ` Junio C Hamano
2014-05-15 18:48         ` Michael Wagner
2014-05-15 19:28           ` Jakub Narębski
2014-05-15 19:37             ` Jakub Narębski
2014-05-15 19:38             ` Junio C Hamano
2014-05-15 20:45               ` Jakub Narębski
2014-05-16  1:26                 ` Junio C Hamano
2014-05-16  7:54                   ` Jakub Narębski
2014-05-16 17:05                     ` Junio C Hamano
2014-05-27 14:18                       ` Jakub Narębski
2014-05-16 18:17                     ` Junio C Hamano
2014-05-27 14:22             ` [PATCH] gitweb: Harden UTF-8 handling in generated links Jakub Narębski
2014-06-04 15:41               ` Michael Wagner
2014-06-04 18:47                 ` Jakub Narębski
2014-06-04 20:47                   ` Michael Wagner
2015-03-23 21:35                   ` What's cooking in git.git (Mar 2015, #08; Mon, 23) Junio C Hamano
2014-12-17 14:18                     ` [PATCH v4] remote: add --fetch and --both options to set-url Peter Wu
2014-12-17 14:32                       ` Jeff King
2014-12-17 14:42                         ` Peter Wu
2014-12-17 22:31                       ` Junio C Hamano [this message]
2015-03-24 22:21                       ` What's cooking in git.git (Mar 2015, #08; Mon, 23) Junio C Hamano
2015-03-26 16:18                         ` Jeff King
2015-03-24 20:02                     ` Junio C Hamano
2015-03-24 20:04                       ` Jeff King
2015-03-24 20:08                     ` Junio C Hamano
2015-03-24 23:37                     ` Junio C Hamano
2015-03-24 22:26                   ` Junio C Hamano
2015-03-25  0:37                     ` Jakub Narębski
2015-03-25  1:05                       ` Junio C Hamano
2014-05-15 12:32       ` [PATCH/RFC] Gitweb: Convert UTF-8 encoded file names Jakub Narębski

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

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

  git send-email \
    --in-reply-to=xmqqr3vx9ad5.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=peter@lekensteyn.nl \
    --cc=tboegi@web.de \
    /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.
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 NNTP newsgroup(s).