Thread (12 messages) 12 messages, 3 authors, 2021-05-30

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

flat view

From: Felipe Contreras <hidden>
Date: 2021-05-28 17:53:15

Mathias Kunter wrote:
quoted
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
quoted
return (fetch_remote && fetch_remote != remote);
to
quoted
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.
I'd argue that if `simple` pushing is used, then the expected behavior 
of the command
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help