On Wed, Mar 16, 2011 at 11:53, Julius Plenz <[email protected]> wrote:
> Hi, Lars!
>
> * Lars Hjemli <[email protected]> [2011-03-10 18:24]:
>> On Thu, Mar 10, 2011 at 17:03, Julius Plenz <[email protected]> wrote:
>> > This is a saner alternative than hardcoding the default branch to be
>> > "master". The add_repo() function will now check for a symbolic ref in
>> > repo_path/HEAD. If there is a suitable one, overwrite repo->defbranch
>> > with it.
>>
>> I agree with the motivation, but...
>
>> > +        fd = open(fmt("%s/HEAD", repo->path), O_RDONLY);
>
>> ...since git supports fs links, you'll need to lstat() and then
>> either readlink() or read_in_full(). And if you readlink(), you'll
>> obviously need to parse the result differently.
>
> I just tried this out:
>
>    $ cd /repositories/...
>    $ mv HEAD head
>    $ ln -s head HEAD
>
> The patch handles that just fine (it wouldn't if I were to add the
> O_NOFOLLOW flag);

Yeah, but try this instead:

$ cd $repo/.git
$ mv HEAD HEAD.old
$ ln -s refs/heads/master HEAD

This is what git supports, and the patch needs to readlink() to handle the same.

--
larsh

_______________________________________________
cgit mailing list
[email protected]
http://hjemli.net/mailman/listinfo/cgit

Reply via email to