git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 4/6] remote.c: introduce a way to have different remotes for fetch/push

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Mar 23, 2013, 12:57 UTC
Message-ID
<CALkWK0nhOa-xJDzx7K7W7ZsRjkMJwqEyy32Q-R_ApZV-=BWKSQ@mail.gmail.com>
In-Reply-To
<7vli9f5bho.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
Show 45 quoted lines
> Jonathan Nieder <jrnieder@gmail.com> writes:
>
>>> --- a/builtin/push.c
>>> +++ b/builtin/push.c
>>> @@ -322,7 +322,7 @@ static int push_with_options(struct transport *transport, int flags)
>>>  static int do_push(const char *repo, int flags)
>>>  {
>>>      int i, errs;
>>> -    struct remote *remote = remote_get(repo);
>>> +    struct remote *remote = pushremote_get(repo);
>>
>> "struct remote" has url and pushurl fields.  What do they mean in the
>> context of these two accessors?  /me is confused.
>>
>> Is the idea that now I should not use pushurl any more, and that I
>> should use pushremote_get and use url instead?
>
> I thought the basic idea from the user-level is:
>
>  - If you have to use different URL to push to and fetch from the
>    logically same location (e.g. git://k.org/pub/scm/git/git.git
>    used for fetch, k.org:/pub/scm/git/git.git/ used for push), use
>    url for fetch, pushurl for push and you don't have to bother with
>    per-branch pushremote at all.  You are logically working with the
>    same remote, perhaps called 'origin'.
>
>  - If you push to and fetch from logically different repositories,
>    (e.g. fetch from https://github.com/gitster/git, push to
>    github.com:artagnon/git), you may want to call your upstream
>    'origin' and your publishing repository 'mine'.  You set the
>    remote.pushdefault to 'mine', perhaps like:
>
>         [remote "mine"]
>                 url = github.com:artagnon/git
>
>    (this can also be written with remote.mine.pushurl).
>
> By splitting remote_get() used for fetch and pushremote_get() used
> for push, the latter function can return 'origin' and 'mine' for
> these two cases, while remote_get() will return 'origin' for both of
> these cases.  At the programming level, you would still ask what the
> URL to be pushed to to the remote obtained here, and would use
> pushurl if defined, or url otherwise.
>
> Ram, am I following your thoughts correctly?
Exactly.  I couldn't have said it better myself.
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 19 of 24 in “Support triangular workflows”
  1. 0/6 Support triangular workflowsRamkumar Ramachandra, Mar 22, 2013
  2. 1/6 remote.c: simplify a bit of code using git_config_string()Ramkumar Ramachandra, Mar 22, 2013
  3. Jonathan NiederMar 22, 2013
  4. 2/6 t5516 (fetch-push): update test descriptionRamkumar Ramachandra, Mar 22, 2013
  5. Jonathan NiederMar 22, 2013
  6. 3/6 t5516 (fetch-push): introduce mk_test_with_name()Ramkumar Ramachandra, Mar 22, 2013
  7. Jeff KingMar 22, 2013
  8. Junio C HamanoMar 22, 2013
  9. Jeff KingMar 22, 2013
  10. Jonathan NiederMar 22, 2013
  11. Ramkumar RamachandraMar 28, 2013
  12. Junio C HamanoMar 22, 2013
  13. Jeff KingMar 22, 2013
  14. 4/6 remote.c: introduce a way to have different remotes for fetch/pushRamkumar Ramachandra, Mar 22, 2013
  15. Jonathan NiederMar 22, 2013
  16. Junio C HamanoMar 22, 2013
  17. Jonathan NiederMar 22, 2013
  18. Ramkumar RamachandraMar 23, 2013
  19. Ramkumar RamachandraMar 23, 2013
  20. 5/6 remote.c: introduce remote.pushdefaultRamkumar Ramachandra, Mar 22, 2013
  21. Jeff KingMar 22, 2013
  22. Ramkumar RamachandraMar 27, 2013
  23. 6/6 remote.c: introduce branch.<name>.pushremoteRamkumar Ramachandra, Mar 22, 2013
  24. Junio C HamanoMar 22, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.