Have scan-path only pull in unlisted repositories

John Keeping john at keeping.me.uk
Fri Jul 24 11:21:25 CEST 2015

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).

More information about the CGit mailing list