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

Re: Bug report: stash in upstream caused remote fetch to fail

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 6, 2014, 23:22 UTC
Message-ID
<xmqq4n5ghf0z.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20140106230348.GA7811@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 18 quoted lines
> Then we ask fetch_refs_via_pack to get the actual objects for us. And
> it checks our refs again, with this call chain:
>
>   do_fetch
>     fetch_refs
>       transport_fetch_refs
>         fetch_refs_via_pack
>           fetch_pack
>             do_fetch_pack
>               everything_local
>                 filter_refs
>                   check_refname_format
>
> Here, the code looks like this:
>
>   if (!memcmp(ref->name, "refs/", 5) &&
>       check_refname_format(ref->name + 5, 0))
>     ; /* trash */

I think this should feed ref->name, not ref->name + 5; an obvious alternative would be to use REFNAME_ALLOW_ONELEVEL; you are also right that && is probably a misspelt ||; this is about protecting ourselves from creating garbage in our ref namespace, so accepting anything outside refs/ makes little sense.

> It's really not clear to me what the check in filter_refs was trying to
> do. It dates all the way back to 1baaae5 (Make maximal use of the remote
> refs, 2005-10-28), but there is not much explanation. I haven't dug into
> the list around that time to see if there's any discussion.

I think the "funny refs" the log message talks about is about filtering "we know we can reach these objects via our alternates, but these are not refs we actually have".

Previous: Jeff KingNext: Junio C Hamano
Message 7 of 10 in “Re: Bug report: stash in upstream caused remote fetch to fail”
  1. Matt BurkeJan 3, 2014
  2. Jeff KingJan 6, 2014
  3. Junio C HamanoJan 6, 2014
  4. Jeff KingJan 6, 2014
  5. Junio C HamanoJan 6, 2014
  6. Jeff KingJan 6, 2014
  7. Junio C HamanoJan 6, 2014
  8. Junio C HamanoJan 7, 2014
  9. Jeff KingJan 15, 2014
  10. Jeff KingJan 15, 2014

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.