Re: [PATCH v3] remote: add get-url subcommand
Ben Boeckel writes: > On Wed, Aug 05, 2015 at 13:34:18 -0700, Junio C Hamano wrote: >> Changes to these two files look reasonable. >> >> Don't you want to protect this feature from future breakage by >> others by adding a couple of tests, though, to t/t5505? > > Thanks, I've done so locally. It actually brings up this case: > > $ git remote add someremote foo > $ git remote get-url --push someremote > fatal: no URLs configured for remote 'someremote' > > Is it better to use: > > remote = remote_get(remotename); > remote->pushurl; > > if (remote->pushurl_nr) > remote->pushurl; > else > remote->url; > > or: > > remote = pushremote_get(remotename); > remote->pushurl; > > ? What is the actual difference between the two? You tell me ;-) The default remote based on the current branch is computed differently based on the direction of the transfer, I think. struct remote *remote_get(const char *name) { return remote_get_1(name, remote_for_branch); } struct remote *pushremote_get(const char *name) { return remote_get_1(name, pushremote_for_branch); } When you are not giving name explicitly, the second parameter to _1 function is used to determine the name. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3] remote: add get-url subcommand
On Wed, Aug 05, 2015 at 13:34:18 -0700, Junio C Hamano wrote: > Changes to these two files look reasonable. > > Don't you want to protect this feature from future breakage by > others by adding a couple of tests, though, to t/t5505? Thanks, I've done so locally. It actually brings up this case: $ git remote add someremote foo $ git remote get-url --push someremote fatal: no URLs configured for remote 'someremote' Is it better to use: remote = remote_get(remotename); remote->pushurl; if (remote->pushurl_nr) remote->pushurl; else remote->url; or: remote = pushremote_get(remotename); remote->pushurl; ? What is the actual difference between the two? Thanks, --Ben -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3] remote: add get-url subcommand
Ben Boeckel writes: > Expanding `insteadOf` is a part of ls-remote --url and there is no way > to expand `pushInsteadOf` as well. Add a get-url subcommand to be able > to query both as well as a way to get all configured urls. > > Signed-off-by: Ben Boeckel > --- > Documentation/git-remote.txt | 10 > builtin/remote.c | 54 > > 2 files changed, 64 insertions(+) Changes to these two files look reasonable. Don't you want to protect this feature from future breakage by others by adding a couple of tests, though, to t/t5505? Thanks. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html