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

Re: Question about possible git races

From
Junio C Hamano <junkio@cox.net>
Date
Mar 23, 2006, 00:24 UTC
Message-ID
<7vacbi6m91.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<200603201724.12442.astralstorm@o2.pl>
Radoslaw Szkodzinski <astralstorm@o2.pl> writes:
Show 5 quoted lines
> - push vs pull
>
> - push vs push
>
> - fetch vs fetch

About push vs push, with "really bare git", I take it that you mean two send-pack from remote sites running two receive-pack simultaneously.

There is an explicit race avoidance between the receive-pack processes. When a ref (either branch head or a tag) is updated, it does:

 - read the current value from the ref.
 - do its work.
 - lock to prevent others to create the temporary file for
   updating the ref.
 - create the temporary file for the ref and write the new value.
 - check if the ref's value has not changed from what it
   initially read;
 - rename the temporary file to the ref to unlock.

Read receive-pack.c::update() for exact details if you are interested.

> I'm meaning really bare git there, w/o bash+perl scripts.

The question does not make any sense for other cases, because branch update by fetch and pull are all scripts based.

Previous: Radoslaw SzkodzinskiNext: Radoslaw Szkodzinski
Message 8 of 10 in “Question about possible git races”
  1. Radoslaw SzkodzinskiMar 20, 2006
  2. Radoslaw SzkodzinskiMar 22, 2006
  3. Andreas EricssonMar 22, 2006
  4. Andreas EricssonMar 22, 2006
  5. Radoslaw SzkodzinskiMar 23, 2006
  6. Andreas EricssonMar 23, 2006
  7. Radoslaw SzkodzinskiMar 23, 2006
  8. Junio C HamanoMar 23, 2006
  9. Radoslaw SzkodzinskiMar 23, 2006
  10. Junio C HamanoMar 23, 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.