[PATCH 2/2] Add feature: obtain repo section from git config

Ferry Huberts mailings at hupie.com
Mon Jun 6 20:39:34 CEST 2011


On 06/06/2011 08:31 PM, Jamie Couture wrote:
> On 11-06-06 01:38 PM, Ferry Huberts wrote:
>> On 06/06/2011 07:13 PM, larsh at hjemli.net wrote:
>>> On Fri, Jun 03, 2011 at 07:21:02PM -0400, Jamie Couture wrote:
>>>> +section-from-repo-config::
>>>> +    If set to "1" obtain the section name from git config. The
>>>> expected config
>>>> +    section.key that is used is "cgit.section".
>>>> +    Ex: $ git config cgit.section mysection
>>>> +    An alternative to section-from-path, and will not check git
>>>> config if
>>>> +    section-from-path is set. See also: scan-path.  This must be
>>>> defined prior
>>>> +    to scan-path.
>>>> +
>>> * What value is added by $GITDIR/config compared to $GITDIR/cgitrc?
>>> * If we want to support reading repo-config from $GITDIR/config, why not
>>>    implement all the options supported by a $GITDIR/cgitrc?
>>>
>> I thought about this too.
>>
>> It seems attractive but to me is mixing concerns: git and cgit are two
>> different tools (although closely tied). Having cgit store (part of) its
>> configuration in git configuration files is not good architecture,
>> unwise and fragile since it make the cgit configuration directly
>> dependent on git configuration. cgit can't change it's configuration
>> format since it has to follow git's and once git changes its format cgit
>> immediately breaks.
> The motivation was more about being lazy for those who use scan-path to
> pick up repositories, and only serves to help the presentation /
> separation of sections in the front-end, but is by no means easier to
> maintain.  I agree that mixing configuration is clumsy.
> 
> In my case, I was using gitoilte + cgit.  Perhaps I overlooked a feature
> of gitolite to create repositories based on some path, say:
> parent/{section1, ..., sectionN}/actual_project.git (the
> section-from-path feature should have been used in this case). Instead
> everything is living as children from a common parent, which is how I
> currently have it setup.
> 
>> I'd prefer not doing this (everything in $GITDIR/config). I think it's
>> better to have $GITDIR/cgitrc files that hold the repo settings.
>>
>> There is this setting called repo.path though that then is kind of an
>> annoyance to set and update. If we always use $GITDIR/cgitrc files then
>> the repo.path setting could be automatically deduced by cgit.
>>
> I was trying to do as little touching of cgitrc as possible, with
> respect to updating / maintaining repository information.
> 


You could use something like I do:
cgitrc includes a file called 'sections'
the sections file includes all separate section files.
a separate section file includes all separate repo cgitrc files

this makes every include a single line to maintain

this allows me to quickly change repos from section without touching the
cgitrc. also allows me to quickly change section descriptions without
touching cgitrc. and keeps cgit repo config together with the git repo
and easy to maintain

-- 
Ferry Huberts




More information about the CGit mailing list