Web lists-archives.com

Git server side "pre-receive" hook to create new repositories




Some time ago, Feb 2018, I put in a proposal at Swift.org , that would
allow the Swift Package Manager to clone packages from the Internet to a
local git server and use the local version without requiring updates to
the Swift package:
https://forums.swift.org/t/proposal-to-enable-spm-to-use-a-local-repository-mirror/10291/5
.  At the time, I also raised an issue at
https://github.com/github/platform-samples/issues/171 asking for the
feature described below.  However, today I realised that that was not
the right place to make such a request, and hence I've written this email.

The above thread contains a solution to the local mirror problem whose
only drawback was that new repositories had to be MANUALLY initialised
bare on the local server.  In all other respects, in my opinion, the
solution worked perfectly and saved me downloading huge amounts of data
each time I performed a distribution clean on the project or switched to
another project that used the same package.  The solution published at
Swift.org used a Ubuntu 16.04.2 server running Git 2.16.2, and the
client was a Macbook Pro running MacOS with its default git.

Thus, this feature request is asking that the 'pre-receive' hook
triggers when someone tries to push to a repository regardless of
whether the repository exists.  This would allow automatic creation of
new repositories and smooth the work-flow described above.  If the
semantics of the existing 'pre-receive' hook are such that it would not
be suitable for such a purpose, then an alternative way of providing the
call-back ability would be implemented.

Best regards,
Dimitri.