Re: [PATCH v3] remote: add --fetch and --both options to set-url

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
> ---

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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]