Have scan-path only pull in unlisted repositories

John Keeping john at keeping.me.uk
Fri Jul 24 15:47:12 CEST 2015


On Fri, Jul 24, 2015 at 11:42:00PM +1000, Matt Hevern wrote:
> On Fri, Jul 24, 2015 at 7:21 PM, John Keeping <john at keeping.me.uk> wrote:
> 
> > On Fri, Jul 24, 2015 at 09:35:05AM +1000, Matt Hevern wrote:
> > > I'd like to be able to specify a number of existing git repositories, and
> > > associated descriptions, sections etc, so that they show up orderly via
> > the
> > > web interface - but I'd also like to set up scan-path so that if anyone
> > > pushes new repositories up, then they will be listed as well. This is
> > > because those
> > > pushing up new repositories may not have access (or inclination) to
> > update
> > > the "/etc/cgitrepos" file, but want to be able to access the new
> > repository
> > > via cgit.
> > > Currently when I do this, I get duplicates of the static configured
> > > repositories I have listed via "include=/etc/cgitrepos", and the
> > > repositories scanned via "scan-path=/home/git/repositories".
> > >
> > > Is there any way to do something like - tell scan-path to only pull in
> > > repositories which are not already listed - or something similar ?
> >
> > You would need to change shared.c::cgit_add_repo() to check whether the
> > repository already exists, but I worry that it could be a bit expensive
> > with a large number of repositories.
> >
> > Have you considered just using scan-path and storing the configuration
> > in the individual repositories?  CGit will read extra configuration for
> > each repository from a "cgitrc" file in the repository or from the Git
> > config file (if "enable-git-config" is set).
> >
> 
> Thanks - I'll try this. As long as I can pull in new repositories after any
> existing described ones, that should be fine.

Do you mean that you need described ones sorted prior to the new ones?
I don't think that will work trivially, but if you put the repositories
into separate sections then it should be possible.

I *think* (but have not tested) that something like this will work:

	section-sort=0
	section=Described
	section=New

	scan-path=/path/to/repos

with described repositories setting "section=Described" (the new ones
should pick up the last "section" before the "scan-path" in the global
cgitrc).


More information about the CGit mailing list