[prev in list] [next in list] [prev in thread] [next in thread]
List: cgit
Subject: [PATCH 1/5] guess default branch from HEAD
From: hjemli () gmail ! com (Lars Hjemli)
Date: 2011-03-26 10:08:46
Message-ID: AANLkTinXxAmG+t7Z8KCWh_U6drYRFrjuEnUotgSrkVHO () mail ! gmail ! com
[Download RAW message or body]
On Wed, Mar 16, 2011 at 11:53, Julius Plenz <plenz at cis.fu-berlin.de> wrote:
> Hi, Lars!
>
> * Lars Hjemli <hjemli at gmail.com> [2011-03-10 18:24]:
>> On Thu, Mar 10, 2011 at 17:03, Julius Plenz <plenz at cis.fu-berlin.de> 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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic