On Wed, Jan 08, 2014 at 05:27:07AM -0500, Jeff King wrote:

> This patch passes the test suite by itself (with or without that fixup).
> But oddly, it seems to fail t5531 when merged with 'next'. I can't
> figure out why, though. It shouldn't affect any code that doesn't look
> at branch->pushremote.

OK, I figured it out. My patch calls:


which creates an origin remote, even if one does not exist (it assumes
it to be a URL "origin"). Later, when we want to decide if the push is
triangular or not, we ask for:


which will internally look for a remote called "origin". Before my patch
there was not such a remote, and so the push could not be triangular.
After my patch, it finds the bogus remote and says "this thing exists,
and is not what we are pushing to; therefore the push is triangular".

The solution is that I should not be passing the term "origin" to
remote_get, but rather passing NULL and relying on it to figure out the
default remote correctly. I.e.:

diff --git a/remote.c b/remote.c
index 8724388..d214fa2 100644
--- a/remote.c
+++ b/remote.c
@@ -1574,7 +1574,7 @@ struct branch *branch_get(const char *name)
        else if (ret->remote_name)
                ret->pushremote = remote_get(ret->remote_name);
-               ret->pushremote = remote_get("origin");
+               ret->pushremote = remote_get(NULL);
        return ret;

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to