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

remote-helpers: http-push protocol

From
Sverre Rabbelier <srabbelier@gmail.com>
Date
Aug 29, 2010, 04:57 UTC
Message-ID
<AANLkTim=HKiQ-25QEAPPRcH6wwLLAsDdoRqTsanM67SK@mail.gmail.com>
Heya,

I'm trying to figure out how the current http push protocol is implemented. What I've been able to deduce on my own:

When fetching from the remote, the helper is called with 'list', after which it will give back a list of refs, 'remote' style. That is, the remote master branch will be listed as '<remote sha> refs/heads/master'. When pushing to the remote, the helper is called with 'list for-push', it will again list all refs in the same manner (omitting 'HEAD' if the smart protocol is used).

What happens next is the part that confuses me, a certain set of refs is pushed, by calling the helper with 'push <refspec>'. I am unclear how this set of refs is chosen, I see that only refs that have a peer_ref are sent, unless mirror is also set (I don't think I understand the significance)? After the push, the helper write a set of 'ok/error' messages, sometimes for refs that were not asked to be pushed in the first place, errors for those are ignored though (the error parsing code ignores an error if the ref was not scheduled to be pushed).

Can you clarify the behavior I described? How can I best hook into the 'refs that need to be pushed selection' in the 'export' command [0]?

[0] The export command currently tries to export all refs it gets from push_refs, which seems to be everything that the helper got from the 'list' command. The only reason this has worked so far it seems is that all branches listed by 'list' were present as local branches.

-- 
Cheers,

Sverre Rabbelier
Next: Jonathan Nieder
Message 1 of 2 in “remote-helpers: http-push protocol”
  1. Sverre RabbelierAug 29, 2010
  2. Jonathan NiederSep 7, 2010

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.