Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a new feature that allows for:
Implementation
When you
gitreceive init
, a new script namednewrepo
is created next to thereceiver
script.When a new repository is to be created, the
newrepo
script is called instead of simply creating a new repository.Of course, the default of the
newrepo
script is to add a new repository as always, but it also takes a few other parameters that allow to neat uses of this feature, namely the name of the repository, the username and fingerprint of the user trying to create the repository.Use cases
Performing some checks before creating a new repo.
This allow to control which user/fingerprint can create which repo. Or to inforce some policy on the repo names.
As an example, the following
newrepo
script will make sure that users can only create repo starting with their usernames followed by a dash (note that only the middle part has been edited from the defaultnewrepo
script):And here is the output when you try to git clone (the same happens if you
git remote add
andgit push
on an existing local repo):Calling some commands when a new repo is created
Just append those commands at the end of the
newrepo
script.Please review
This is quite an important change, but I believe the feature could allow many use-cases, as it is quite flexible. For example, I put the
git init --bare
in thenewrepo
script to allow that to be changed if needed (however, make sure that arepo_path
is been created).Please note that if this PR is accepted, current gitreceive users should add a
newrepo
in their existing$GITHOME
s, since it is only created when yougitreceive init
. This means that some communication may be needed.Pleade do review this PR. I tried to stick to the coding conventions I saw, but feel free to mention any problems (e.g. if you don't like the name of the
newrepo
script).Final note: I've put a new link to the wiki on the README, which would have to be populated when/if this PR is merged. The content of this PR can act as a good starting point for that.