From: Junio C Hamano <gitster@pobox.com>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org, peff@peff.net
Subject: Re: [PATCH v2] builtin/push: call set_refspecs after validating remote
Date: Wed, 10 Jul 2024 08:34:39 -0700 [thread overview]
Message-ID: <xmqqle29z2eo.fsf@gitster.g> (raw)
In-Reply-To: <CAOLa=ZQXZ6DyE3YjuVU48nQcj0xuW7uPoPvg2yqktk+S6gXwsg@mail.gmail.com> (Karthik Nayak's message of "Wed, 10 Jul 2024 06:12:21 -0700")
Karthik Nayak <karthik.188@gmail.com> writes:
>> In any case, an obvious additional fix on top of your change might
>> be to do something like this:
>>
>> diff --git i/remote.c w/remote.c
>> index 5fa046c8f8..d7f9ba3571 100644
>> --- i/remote.c
>> +++ w/remote.c
>> @@ -682,7 +682,7 @@ remotes_remote_get_1(
>> struct remote *ret;
>> int name_given = 0;
>>
>> - if (name)
>> + if (name && *name)
>> name_given = 1;
>> else
>> name = get_default(remote_state, remote_state->current_branch,
>>
>> which would give us the default remote name, and we would not call
>> add_url_alias() with a bogus empty string to nuke the list.
>>
>
> I'm a bit skeptical of making this change. Mostly from the user's
> perspective.
> ...
> This is because we actually obtained the default remote here. Isn't this
> confusing from a user's perspective?
I agree with you 100%. I haven't checked the ramifications of such
a change to other code paths, and callers of remote_get() are many.
With your fix, the above is not necessary and it certainly can be
left well outside the scope of the current topic.
> I mean I agree that an empty repo
> name is something we should support, but it also shouldn't be something
> we simply ignore?
For the sake of simplicity of the UI design, I think an empty repo
name (giving an empty string explicitly where a repository nickname
or URL is expected) should be forbidden. The above change lets ""
stand for the default remote (which is different from "simply"
ignoring), and is confusing, because we never did that historically.
Unless we advertise it as a new "feature" [*], that is (and I do not
believe it is such a great feature myself).
> So if we're simply testing my patch, this is definitely enough. But I
> wanted to also keep in mind the state before this patch. Wherein the
> only way the flow would be triggered is if we provide a local_ref,
> providing ':' follows a different path in 'set_refspecs'.
OK. If so we may want to have both, so that we won't regress in the
other code paths?
Thanks.
[Footnote]
* When you want to interact with the remote you usually work with
but want to affect a custom set of refs, with the current UI,
you'd need to remember what you call that usual remote (typically
"origin") and say "git [push|fetch] origin $refspec". The above
change may be seen as a feature that allows you to use an empty
string in place of the remote that has to be named explicitly on
the command line.
next prev parent reply other threads:[~2024-07-10 15:34 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-08 14:03 [PATCH] builtin/push: call set_refspecs after validating remote Karthik Nayak
2024-07-08 19:17 ` Junio C Hamano
2024-07-08 23:33 ` Jeff King
2024-07-09 9:59 ` Karthik Nayak
2024-07-08 23:32 ` Jeff King
2024-07-09 9:05 ` Karthik Nayak
2024-07-09 9:59 ` Jeff King
2024-07-09 14:49 ` [PATCH v2] " Karthik Nayak
2024-07-09 18:44 ` Junio C Hamano
2024-07-09 18:56 ` Junio C Hamano
2024-07-09 23:55 ` Jeff King
2024-07-10 1:04 ` Junio C Hamano
2024-07-10 13:12 ` Karthik Nayak
2024-07-10 15:34 ` Junio C Hamano [this message]
2024-07-10 15:46 ` Jeff King
2024-07-11 9:35 ` Karthik Nayak
2024-07-11 21:32 ` Jeff King
2024-07-11 9:39 ` [PATCH v3] " Karthik Nayak
2024-07-11 15:08 ` Junio C Hamano
2024-07-11 21:33 ` 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=xmqqle29z2eo.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=karthik.188@gmail.com \
--cc=peff@peff.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.