From: Jeff King <peff@peff.net>
To: Peter Wu <peter@lekensteyn.nl>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v3] remote: add --fetch and --both options to set-url
Date: Thu, 4 Dec 2014 04:37:50 -0500 [thread overview]
Message-ID: <20141204093750.GD27455@peff.net> (raw)
In-Reply-To: <1416916106-19892-1-git-send-email-peter@lekensteyn.nl>
On Tue, Nov 25, 2014 at 12:48:26PM +0100, Peter Wu wrote:
> 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.
>
> 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
> operation (without --add or --delete), it will drop pushurl as the
> implicit push URL is the (fetch) URL.
>
> The documentation has also been updated and a missing '--push' option
> is added to the 'git remote -h' command.
>
> Tests are also added to verify the documented behavior.
>
> Signed-off-by: Peter Wu <peter@lekensteyn.nl>
> ---
Sorry for the slowness in reviewing. The design of this version makes
sense to me (not surprising, I guess, since it was in direct response to
my comments).
I didn't see anything glaringly wrong in the implementation, though I
did find it a little hard to follow, because of this:
> +#define MODIFY_TYPE_FETCH (1 << 0)
> +#define MODIFY_TYPE_PUSH (1 << 1)
> +#define MODIFY_TYPE_BOTH (MODIFY_TYPE_FETCH | MODIFY_TYPE_PUSH)
> +#define MODIFY_TYPE_HISTORIC (MODIFY_TYPE_FETCH | (1 << 2))
When reading through the code, the distinction between
modify_type & MODIFY_TYPE_FETCH
and
modify_type == MODIFY_TYPE_FETCH
is significant, because the former matches HISTORIC, while the latter
does not. I imagine that a distinct bit value for HISTORIC would make
things a bit more verbose (you would have to add an extra OR in many
places), but I wonder if it would make the code easier to follow (one of
the things I wanted to check was that HISTORIC does the same thing that
it always did, and it is very hard to follow the HISTORIC behavior
reading the code linearly).
I dunno. I don't insist; just noting a difficulty I had while reading
it. Maybe you went down that route already during development and found
it more painful.
-Peff
next prev parent reply other threads:[~2014-12-04 9:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-25 11:48 [PATCH v3] remote: add --fetch and --both options to set-url Peter Wu
2014-11-25 22:09 ` Eric Sunshine
2014-11-25 22:53 ` Peter Wu
2014-12-04 9:37 ` Jeff King [this message]
2014-12-17 10:08 ` Torsten Bögershausen
2014-12-17 14:20 ` Peter Wu
2014-12-17 14:28 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141204093750.GD27455@peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peter@lekensteyn.nl \
/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).