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

Re: git push doesn't use local branch name as default

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 28, 2021, 17:52 UTC
Message-ID
<60b12dc1f19b1_5190820879@natae.notmuch>
In-Reply-To
<f9f38d42-2b93-0d3b-798b-4c6f44eb111d@gmail.com>
Mathias Kunter wrote:
Show 10 quoted lines
> > you only get the "current" behavior when fetch_remote is non-NULL.
> 
> Well, then my suggestion actually is to also use the `current` behavior 
> when fetch_remote is NULL - i.e. change
> 
> > return (fetch_remote && fetch_remote != remote);
> 
> to
> 
> > return (!fetch_remote || fetch_remote != remote);
It's not quite that easy. You need to see the context of that code:
  static int is_workflow_triangular(struct remote *remote)
  {
    struct remote *fetch_remote = remote_get(NULL);
    return (fetch_remote && fetch_remote != remote);
  }
That would affect many pathways.
Show 7 quoted lines
> I'd argue that if `simple` pushing is used, then the expected behavior 
> of the command
> 
> > git push <remote_name>
> 
> on a branch without upstream would actually be to use the `current` 
> behavior instead of bailing out with an error.
I agree, but this mis-mash of modes makes the logic very hard to see.

I'll send patches to cleanup the logic, it makes no sense to have a frankenstein of two modes and that is in fact the default mode. The logic of the default mode should be crystal clear.

Cheers.
-- 
Felipe Contreras
Previous: Felipe ContrerasNext: Felipe Contreras
Message 8 of 12 in “git push doesn't use local branch name as default”
  1. Mathias KunterMay 28, 2021
  2. Elijah NewrenMay 28, 2021
  3. Mathias KunterMay 28, 2021
  4. Mathias KunterMay 28, 2021
  5. git push default doesn't make senseFelipe Contreras, May 28, 2021
  6. Mathias KunterMay 30, 2021
  7. Felipe ContrerasMay 30, 2021
  8. Felipe ContrerasMay 28, 2021
  9. Felipe ContrerasMay 28, 2021
  10. Elijah NewrenMay 28, 2021
  11. Felipe ContrerasMay 28, 2021
  12. Felipe ContrerasMay 28, 2021

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.