git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Dimitri Joukoff <dimitri.joukoff@griffithuni.edu.au>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Jeff King" <peff@peff.net>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Git server side "pre-receive" hook to create new repositories
Date: Tue, 19 Mar 2019 12:16:07 +0000	[thread overview]
Message-ID: <SYXPR01MB09570A4CBFC30A36150C90BCDD400@SYXPR01MB0957.ausprd01.prod.outlook.com> (raw)
In-Reply-To: 87d0mndxop.fsf@evledraar.gmail.com

Thanks for the feedback.

Whilst I understand the options that you've both proposed, the intent
was to enable the Swift Package Manager to mirror repositories in a
transparent way.  I'll look into whether these options can be
implemented inside the SPM.

Cheers,
Dimitri.


On 19/3/19 7:24 pm, Ævar Arnfjörð Bjarmason wrote:
> On Tue, Mar 19 2019, Jeff King wrote:
>
>> On Sat, Mar 09, 2019 at 10:46:09AM +0000, Dimitri Joukoff wrote:
>>
>>> 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.
>> The pre-receive hook is a bit too late for this. It runs after the
>> server has told the client what it has in the repo, the client decides
>> what to push, and the server has received the pack. So receive-pack
>> would have to know about this and fake having an empty repository. And
>> then figure out where to store the incoming packfile, since we have no
>> repo.
>>
>> So I think it would have to be another hook that runs before the rest of
>> receive-pack. I.e., a system-level config option that says "if you are
>> asked to accept a push for a repo and it doesn't exist, run this instead
>> and then run as usual".
>>
>> It does feel a little error-prone, though, if the client does not
>> positively say "I want you to create this if it doesn't exist".
>> Otherwise if I do "git push server:my-misspelled-repo.git", the result
>> is going to be rather confusing. And retro-fitting that into the
>> receive-pack protocol is going to be tricky.
>>
>> It would be much easier to have a separate endpoint for the client to
>> say "please make this repo if it doesn't exist". And then just run that
>> before doing the push.
>>
>> For an unrestricted client connecting over ssh, we already have that:
>> you can just run "ssh $host git init /path/to/repo". There isn't a
>> similar thing that can be done over HTTP, though.
> Sounds simpler to just change the user's login shell to a wrapper that
> checks if the repo exists, and if not create it before proceeding.
>
> The same with http(s). I.e. in whatever webserver that's now pointing to
> git-http-backend as a script point to the same wrapper script.
>
>




  reply	other threads:[~2019-03-19 12:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-09 10:46 Git server side "pre-receive" hook to create new repositories Dimitri Joukoff
2019-03-19  7:06 ` Jeff King
2019-03-19  9:24   ` Ævar Arnfjörð Bjarmason
2019-03-19 12:16     ` Dimitri Joukoff [this message]
2019-03-21  9:28       ` Sitaram Chamarty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SYXPR01MB09570A4CBFC30A36150C90BCDD400@SYXPR01MB0957.ausprd01.prod.outlook.com \
    --to=dimitri.joukoff@griffithuni.edu.au \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).