"Tao Klerks via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes: > + if (branch && (!branch->merge || !branch->merge[0])) { > + repo_config_get_bool(the_repository, > + "push.autosetupremote", > + &autosetupremote); > + if (autosetupremote) > + return tracking_for_push_dest(remote, branch->refname, err); Before the first push of the branch X where we are asking for X@{push}, i.e. there is not the corresponding branch over there yet and we do not have the remote-tracking branch for it yet, what does this function return? If it continues to error out, then I think this patch may make sense, but ... > + { > + const char *up; > + up = default_missing_upstream(remote, branch, err); > + if (up) > + return up; > + return branch_get_upstream(branch, err); ... shouldn't the precedence order the other way around here ... > + } > case PUSH_DEFAULT_UNSPECIFIED: > case PUSH_DEFAULT_SIMPLE: > { > const char *up, *cur; > > + up = default_missing_upstream(remote, branch, err); > + if (up) > + return up; > + > up = branch_get_upstream(branch, err); > if (!up) > return NULL; ... and here? That is, if branch_get_upstream() finds an explicitly configured one, shouldn't we use that and fall back to the new "missing" code path only when there isn't an explicitly configured one?