git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] branch: make sure the upstream remote is configured

From
Jeff King <peff@peff.net>
Date
Jul 26, 2013, 23:22 UTC
Message-ID
<20130726232208.GC12968@sigill.intra.peff.net>
In-Reply-To
<20130726231211.GB12968@sigill.intra.peff.net>
On Fri, Jul 26, 2013 at 07:12:11PM -0400, Jeff King wrote:
Show 15 quoted lines
> If that is what you want to prevent, I do not think checking for a named
> remote is sufficient. You can also be pushing to a branch on a named
> remote that is not part of your fetch refspec, in which case you do not
> have a tracking branch. I.e.:
> 
>   git clone $URL repo.git
>   cd repo.git
>   git push --set-upstream HEAD:refs/foo/whatever
> 
> For that matter, I wonder what "--set-upstream" would do if used with
> "refs/tags/foo". You would not do that in general, but what about:
> 
>   git push --set-upstream master:master master:v1.0
> 
> I didn't test.

Ah, nevermind. We already catch the case of non-heads (on both the local and remote sides) and abort.

So that makes me more confident that your change is a reasonable one; we are already disallowing a subset of what's possible via "--set-upstream" in the name of preventing weird accidental configurations. This is just fixing another such loophole.

-Peff
Previous: Jeff King
Message 6 of 6 in “branch: make sure the upstream remote is configured”
  1. branch: make sure the upstream remote is configuredCarlos Martín Nieto, Jul 26, 2013
  2. Jeff KingJul 26, 2013
  3. Jeff KingJul 26, 2013
  4. Carlos Martín NietoJul 26, 2013
  5. Jeff KingJul 26, 2013
  6. Jeff KingJul 26, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.