Re: push.default: current vs upstream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Jeff King <peff@xxxxxxxx> writes:
> ...
>> Hmm. So this will actually detect "git push $URL" when $URL matches the
>> remote's configured URL. I feel like this distinction has come up
>> before, and we decided not to equate the two. But now I can't remember
>> where (maybe it when fetching via URL versus via remote?).
>
> This is me merely try to be extra nice without succeeding.

An obvious patch to remove the misguided "be nice and try to see if URLs
are the same" bit should look like this.

 builtin/push.c |   15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/builtin/push.c b/builtin/push.c
index 3e18cd3..765b19c 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -97,17 +97,10 @@ 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)) {
-		struct remote *branch_dest = remote_get(branch->remote_name);
-		const char **branch_dest_url, **dest_url;
-
-		if (!push_url_of_remote(remote, &dest_url) ||
-		    !push_url_of_remote(branch_dest, &branch_dest_url) ||
-		    strcmp(dest_url[0], branch_dest_url[0]))
-			die(_("You are pushing to remote '%s', which is not the "
-			      "upstream of your\ncurrent branch '%s'.\n"),
-			    remote->name, branch->name);
-	}
+	if (strcmp(branch->remote_name, remote->name))
+		die(_("You are pushing to remote '%s', which is not the "
+		      "upstream of your\ncurrent branch '%s'.\n"),
+		    remote->name, branch->name);
 
 	strbuf_addf(&refspec, "%s:%s", branch->name, branch->merge[0]->src);
 	add_refspec(refspec.buf);
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]