Show 40 quoted lines
> Am 28.05.21 um 23:12 schrieb Felipe Contreras:
>
> > Cloning automatically sets up an upstream branch for "master", and
> > therore it passes the safety check of `push.default=simple`, and that is
> > much more dangerous than pushing any other branch.
> >
> > Why do we barf with "fix-1", but not "master"? Doesn't make sense.
> >
> > This is what we want:
> >
> > if (centralized &&
> > (branch->merge_nr && branch->merge && branch->remote_name))
> > {
> > if (branch->merge_nr != 1)
> > die(_("The current branch %s has multiple upstream branches, "
> > "refusing to push."), branch->name);
> >
> > /* Additional safety */
> > if (strcmp(branch->refname, branch->merge[0]->src))
> > die_push_simple(branch, remote);
> > }
> > refspec_appendf(&rs, "%s:%s", branch->refname, branch->refname);
> >
> >
> > In other words: `simple` should be the same as `current`, except when
> > there's an upstream branch configured *and* the destination branch has a
> > different name.
>
> I guess so. In particular, as a simple git user, I'd expect the
> following to work out of the box, without having to manually adjust the
> configuration settings:
>
> git clone ssh://originUrl .
> git checkout -b myBranch
> git push # expected push to origin/myBranch, but fails
> git push origin # expected push to origin/myBranch, but fails
> git remote add myRemote ssh://myRemoteUrl
> git push myRemote # expected push to myRemote/myBranch - works
>
> Will your provided patch fix these failing push commands?