Search code examples
gitgitolitecgit

gitolite run hook on 'wild' repository creation


I need to run a script that will generate the projects.list file when a new repository is created by one the members of my team.

We develop firmware that branch off from a 'master', but the branches will never be merged back into master. Since there will never be a merge back I decided to make repositories for every distinct version of firmware. I have developed a bash script that will create the projects.list file for me.

find repositories/ -iname "*.git" -type d | grep --invert-match "gitolite-admin" | sed 's/repositories\///g' > /srv/git/projects.list

Now I am having trouble creating the hook to call that script.

I have tried getting gitolite to generate the file for me but have had no luck with it. Any help is appreciated. Thanks!

Answer

In config/gitolite.conf I made the repo def look like this:

repo    Firmware/[a-zA-Z0-9].*/[a-zA-Z0-9].*
        C       =   @all
        RW+     =   @all
        R = gitweb
        config gitweb.owner = Repo Manager

Solution

  • As mentioned in Gitolite "interfacing with external tools",

    The list of gitweb-readable repos is written to a file whose name is given by the rc file variable GITWEB_PROJECTS_LIST.
    The default value of this variable, if it is not specified or empty, is $HOME/projects.list.

    So unless you make your repo readable by the special user gitweb, Gitolite won't generate/complete the $HOME/projects.list for you.