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

Re: [PATCH 1/4] git-init-db should error out with a message

From
Junio C Hamano <junkio@cox.net>
Date
Oct 26, 2005, 20:27 UTC
Message-ID
<7v3bmoc9d7.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20051026194520.GC8030@steel.home>
Alex Riesen <fork0@users.sourceforge.net> writes:
> Not just that. It would be interesting to give the user an option to
> use the file references ("ref: refs/heads/master").

Actually, the users should not have to care how HEAD reference is implemented. It might make sense to use regular file symref regardless of platforms (i.e. never define USE_SYMLINK_HEAD on any platform).

We support reading from either kind of symref, so if we did that, the only case that *could* matter form compatibility point of view is that repositories touched by the updated git is unusable for an ancient git that does not understand regular file symref. From performance and simplicity point of view, however, using symlink when possible is better, and that is what Johannes' patch does.

HOWEVER, I think "falling back" (both in Johannes' patch which is in the "master" branch, and your version) has a funny failure mode. What happens when two processes try redirecting .git/HEAD simultaneously, possibly to different branch heads? Both of them unlink(), one successfully does symlink(), and the other gets EEXIST and falls back to create regular file symref.

Which is probably not so wrong; if this race matters, then you have bigger problem -- the user is doing 'git checkout' of different branches at the same time, or something silly like that. But it does not feel quite right, either.

Previous: Alex RiesenNext: Alex Riesen
Message 3 of 5 in “git-init-db should error out with a message”
  1. 1/4 git-init-db should error out with a messageJohannes Schindelin, Oct 25, 2005
  2. Alex RiesenOct 26, 2005
  3. Junio C HamanoOct 26, 2005
  4. Alex RiesenOct 26, 2005
  5. Junio C HamanoOct 26, 2005

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.