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

remote_get_heads: reference length limit

From
Andy Whitcroft <apw@shadowen.org>
Date
Sep 5, 2006, 12:50 UTC
Message-ID
<44FD729D.4020208@shadowen.org>

I've been having trouble with git push apparently resending the entire commit trace for the branch each and every time I push. Poking at the source it seems this is due to a length limit on reference names as pulled from the remote repository.

When we are building the pack to send we are sent a list of remote heads. get_remote_heads() reads these in, validates them and finally adds them to the remote_refs list. Part of the validation is a simple check for size and form; check_ref().

static int check_ref(const char *name, int len, unsigned int flags)
{
        if (!flags)
                return 1;
        if (len > 45 || memcmp(name, "refs/", 5))
                return 0;
[...]
}

With the refs/heads/ prefix included this limits the head names to 34 characters. From what I can see there is no good reason for this limit to be so low. I can see we don't want the remote end bloating us out of control, but we are already limiting the lines which contain these references to 1000 bytes and making no attempt to limit the number of them the remote server can send us. There seems to be no limits imposed on the name length other than MAX_PATHLEN.

Can anyone see a reason to keep this (len > 45) check?
-apw
Next: Junio C Hamano
Message 1 of 3 in “remote_get_heads: reference length limit”
  1. Andy WhitcroftSep 5, 2006
  2. Junio C HamanoSep 5, 2006
  3. send pack remove remote reference limitAndy Whitcroft, Sep 5, 2006

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.