git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Denton Liu <liu.denton@gmail.com>
Cc: git@vger.kernel.org, anmolmago@gmail.com, briankyho@gmail.com,
	david.lu97@outlook.com, shirui.wang@hotmail.com,
	f.francet@hotmail.com
Subject: Re: [RFC PATCH] remote: add --fetch option to git remote set-url
Date: Mon, 29 Oct 2018 14:57:28 +0900	[thread overview]
Message-ID: <xmqqftwp47nb.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <1d1b0fe85ddd89cf8172e730e8886d5b4a9ea7eb.1540627720.git.liu.denton@gmail.com> (Denton Liu's message of "Sat, 27 Oct 2018 04:09:07 -0400")

Denton Liu <liu.denton@gmail.com> writes:

> This adds the --fetch option to `git remote set-url` such that when
> executed we move the remote.*.url to remote.*.pushurl and set
> remote.*.url to the given url argument.
>

I suspect this is a horrible idea from end-user's point of view.
"set-url --push" is used to SET pushURL instead of setting URL and
does not MOVE anything.  Why should the end user expect and remember
"set-url --fetch" works very differently?  

If there is a need for a "--move-URL-to-pushURL-and-set-pushURL"
short-hand to avoid having to use two commands

	git remote set-url --push $(git remote --get-url origin) origin
	git remote set-url $there origin

it should not be called "--fetch", which has a strong connotation of
being an opposite of existing "--push", but something else.  And
then we need to ask ourselves if we also need such a short-hand to
"--move-pushURL-to-URL-and-set-URL" operation.  The answer to the
last question would help us decide if (1) this combined operation is
a good idea to begin with and (2) what is the good name for such an
operation.

Assuming that the short-hand operation is a good idea in the first
place, without deciding what the externally visible good name for it
is, let's read on.

> +	/*
> +	 * If add_mode, we will be appending to remote.*.url so we shouldn't move the urls over.
> +	 * If pushurls exist, we don't need to move the urls over to pushurl.
> +	 */
> +	move_fetch_to_push = fetch_mode && !add_mode && !remote->pushurl_nr;

Should this kind of "the user asked for --fetch, but sometimes it is
not appropriate to honor that request" be done silently like this?

Earlier you had a check like this:

> +	if (push_mode && fetch_mode)
> +		die(_("--push --fetch doesn't make sense"));

If a request to "--fetch" is ignored when "--add" is given, for
example, shouldn't the combination also be diagnosed as "not making
sense, we'd ignore your wish to use the --fetch option"?  Similarly
for the case where there already is pushurl defined for the remote.

This is a different tangent on the same line, but it could be that
the user wants to have two (or more) pushURLs because the user wants
to push to two remotes at the same time with "git push this-remote",
so silently ignoring "--force" may not be the right thing in the
first place.  We may instead need to make the value of URL to an
extra pushURL entry (if we had one, we now have two).


  reply	other threads:[~2018-10-29  5:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-27  8:09 [RFC PATCH] remote: add --fetch option to git remote set-url Denton Liu
2018-10-29  5:57 ` Junio C Hamano [this message]
2018-10-30  7:56   ` Denton Liu
2018-10-30 10:11     ` Junio C Hamano
2018-11-09  2:37       ` [RFC PATCH v2] remote: add --save-push " Denton Liu
2018-11-09  3:15         ` Junio C Hamano
2018-11-09  5:20           ` [PATCH v3] remote: add --save-to-push " Denton Liu
2018-11-13  9:46             ` Junio C Hamano
2018-12-10 14:15             ` [PATCH v4] " Denton Liu

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=xmqqftwp47nb.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=anmolmago@gmail.com \
    --cc=briankyho@gmail.com \
    --cc=david.lu97@outlook.com \
    --cc=f.francet@hotmail.com \
    --cc=git@vger.kernel.org \
    --cc=liu.denton@gmail.com \
    --cc=shirui.wang@hotmail.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).