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

Re: [Crash] git-push $remote $non_ref:$anything

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Jun 15, 2008, 21:06 UTC
Message-ID
<alpine.LNX.1.00.0806151626260.19665@iabervon.org>
In-Reply-To
<20080615195541.GA7683@sigill.intra.peff.net>
On Sun, 15 Jun 2008, Jeff King wrote:
Show 21 quoted lines
> [cc'ing Daniel for remote.c advice]
> 
> On Sun, Jun 15, 2008 at 09:38:23PM +0200, Mike Hommey wrote:
> 
> > I somehow managed to get a segfault by running this:
> > 
> > git push origin non-existant-branch-name:non-existant-branch-name
> 
> Hmm. The problem is the ref-guessing code. Given "git push foo:bar",
> when we try to figure out what "bar" means we first try to find
> refs/heads/bar or refs/heads/bar on the remote. But if that fails, we
> are pushing a new item, so we try to use the same prefix as what "foo"
> resolved to (e.g., if "foo" is a branch, we make it "refs/heads/bar").
> 
> So if "foo" doesn't resolve, we end up dereferencing NULL as part of our
> guess. And the fix is obvious and the patch is below.
> 
> But it kind of makes me wonder why we bother looking at the dst side of
> the refspec at all, since the src has already failed. Is there a good
> reason not to just bail from match_explicit when we can't resolve the
> src?

The only thing I can think of is that a user might have made some mistake that would be more obvious with the error messages about both sides. Aside from that, it doesn't seem to have any possible effects anyway.

	-Daniel
*This .sig left intentionally blank*
Previous: Jeff KingNext: Jeff King
Message 3 of 5 in “[Crash] git-push $remote $non_ref:$anything”
  1. Mike HommeyJun 15, 2008
  2. Jeff KingJun 15, 2008
  3. Daniel BarkalowJun 15, 2008
  4. Jeff KingJun 16, 2008
  5. Jeff KingJun 16, 2008

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.