Re: [PATCH 1/3] push: introduce new push.default mode "simple"
- From
Jeff King <peff@peff.net>
- Date
- Apr 19, 2012, 23:46 UTC
- Message-ID
- <20120419234609.GA6020@sigill.intra.peff.net>
- In-Reply-To
- <1334876234-20077-2-git-send-email-Matthieu.Moy@imag.fr>
On Fri, Apr 20, 2012 at 12:57:12AM +0200, Matthieu Moy wrote:
Show 19 quoted lines
> diff --git a/builtin/push.c b/builtin/push.c
> index d315475..4602cd8 100644
> --- a/builtin/push.c
> +++ b/builtin/push.c
> @@ -65,7 +65,17 @@ static void set_refspecs(const char **refs, int nr)
> }
> }
>
> -static void setup_push_upstream(struct remote *remote)
> +static int push_url_of_remote(struct remote *remote, const char ***url_p)
> +{
> + if (remote->pushurl_nr) {
> + *url_p = remote->pushurl;
> + return remote->pushurl_nr;
> + }
> + *url_p = remote->url;
> + return remote->url_nr;
> +}
> +Eh, what's this? This wasn't part of my patch. It was part of Junio's patch which mine was based on (and it provokes a "defined but not used" warning when your patch is applied on top of master).
Show 9 quoted lines
> @@ -87,6 +97,35 @@ static void setup_push_upstream(struct remote *remote)
> if (branch->merge_nr != 1)
> die(_("The current branch %s has multiple upstream branches, "
> "refusing to push."), branch->name);
> + if (strcmp(branch->remote_name, remote->name))
> + die(_("You are pushing to remote '%s', which is not the upstream of\n"
> + "your current branch '%s', without telling me what to push\n"
> + "to update which remote branch."),
> + remote->name, branch->name);And this was from Junio's patch, which is really a separate topic (that "git push foo" should not respect an upstream branch name when the upstream remote is not "foo").
So I think your rebase turned out a little funny. We probably want to pull in Junio's patch from the tip of jc/push-upstream-sanity (135dade). Though even that can be pared down a little. The push_url_of_remote refactoring was part of an early iteration and does not have to be part of the final version (though I think it is a fine refactoring on its own).
> diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh > index b5417cc..f4f9d06 100755 > --- a/t/t5516-fetch-push.sh > +++ b/t/t5516-fetch-push.sh
135dade creates a new t5528 for testing push.default settings, so tests could go there.
-Peff