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

Re: concurrent fetches to update same mirror

From
Jeff King <peff@peff.net>
Date
Jan 5, 2011, 22:57 UTC
Message-ID
<20110105225752.GA9774@sigill.intra.peff.net>
In-Reply-To
<4D24F3E9.3070904@gmail.com>
On Wed, Jan 05, 2011 at 04:42:49PM -0600, Neal Kreitzinger wrote:
> In the case of concurrent pulls to the same non-bare repo, could the
> working tree or index get corrupted, or does git have concurrency
> control mechanisms for this too?

There's a lock on the index, so it shouldn't be corruptable; one process will just end up waiting. I'm not sure offhand whether writing working tree files is done under any lock, but I would tend to think not, since it can be a long process. However, writing the same file twice should be OK; we unlink the old version and create the new from scratch. So the first writer will get its write-in-progress unlinked, and the second one will "win".

-Peff
Previous: Neal KreitzingerNext: Junio C Hamano
Message 8 of 12 in “concurrent fetches to update same mirror”
  1. Neal KreitzingerJan 5, 2011
  2. Jeff KingJan 5, 2011
  3. Shawn PearceJan 5, 2011
  4. Jeff KingJan 5, 2011
  5. Jeff KingJan 5, 2011
  6. Neal KreitzingerJan 5, 2011
  7. Neal KreitzingerJan 5, 2011
  8. Jeff KingJan 5, 2011
  9. Junio C HamanoJan 5, 2011
  10. Jeff KingJan 6, 2011
  11. Marc BranchaudJan 7, 2011
  12. Marc BranchaudJan 7, 2011

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.