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. changequoted
return (fetch_remote && fetch_remote != remote);toquoted
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 commandquoted
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