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