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

Re: git-cvsserver & push/commit atomically

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 13, 2006, 00:17 UTC
Message-ID
<Pine.LNX.4.63.0602130110590.21465@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<46a038f90602121550v4f487edfs788885a78c1b167@mail.gmail.com>
Hi,
On Mon, 13 Feb 2006, Martin Langhoff wrote:
Show 11 quoted lines
>  - precondition: all the relevant objects are already in the repo
>  - reads old sha1
>  - creates repo.git/refs/<headname>.lock file with new sha1
>  - compares old and current head
>  - runs update hooks
>  - renames repo.git/refs/<headname>.lock into repo.git/refs/<headname>
> 
> So it is mostly race-safe, except for the window while we are running
> update hooks. Only a misbehaving implementation that doesn't fail on
> the creation of repo.git/refs/<headname>.lock  would affect us there,
> though. Would locking repo.git/refs/<headname> make sense?

Correct. The filesystem way to lock is to create a lock file and fail if it already exists. Since you are doing something akin to git-commit, I think you *must* lock repo.git/refs/<headname>.

> git-cvsserver commits are likely to be slow (not only likely, they
> _are_ slow right now), so we need a way to block other clients for a
> relatively long time.

I don't think there is a way around that. Of course, you could write the objects first without locking. But then you probably have loose objects in the repository if the commit fails due to another commit in the meantime.

<becomessweatyhands>
	BTW when are we going to see git-cvsserver?
</becomessweatyhands>

Ciao, Dscho

Previous: Martin LanghoffNext: Randal L. Schwartz
Message 2 of 3 in “git-cvsserver & push/commit atomically”
  1. Martin LanghoffFeb 12, 2006
  2. Johannes SchindelinFeb 13, 2006
  3. Randal L. SchwartzFeb 13, 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.