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

From: Junio C Hamano <junkio@cox.net>
Date: 2005-10-27 06:27:00
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.


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Thu Oct 27 06:27:35 2005

This archive was generated by hypermail 2.1.8 : 2005-10-27 06:27:46 EST