git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Taylor Blau <me@ttaylorr.com>
To: Toon Claes <toon@iotcl.com>
Cc: git@vger.kernel.org
Subject: Re: Teach git-fetch(1) to use a quarantine directory
Date: Mon, 17 Jul 2023 10:06:30 -0400	[thread overview]
Message-ID: <ZLVK5nzVZU48uvYE@nand.local> (raw)
In-Reply-To: <87edl6bx7o.fsf@iotcl.com>

On Mon, Jul 17, 2023 at 12:48:17PM +0200, Toon Claes wrote:
> Hi,
>
> I've been looking into making git-fetch(1) to use a quarantine
> directory, but I'm a bit stuck on direction.

What are you hoping to accomplish? receive-pack quarantines its objects
to ensure that the pre-receive hook(s) are all OK before accepting the
push. See 722ff7f876c (receive-pack: quarantine objects until
pre-receive accepts, 2016-10-03) for more of the details there.

Are you suggesting that fetch be taught the same, so that we can
quarantine the pack sent from a remote before moving it into the main
repository?

> I took git-receive-pack(1) as an example how it uses a quarantine
> directory. It seems it sets the environment variables
> $GIT_OBJECT_DIRECTORY and $GIT_ALTERNATE_OBJECT_DIRECTORIES so the real
> object db is used as an alternative, and a temporary is set as the
> default. Then a sub-process is spawned to uses these. In case of
> git-receive-pack(1), it calls git-unpack-objects(1).
>
> At the moment git-fetch(1) does not spawn any similar subprocess, so if
> we want to take the same approach to use the quarantine, we'll need to
> split up that command.

That doesn't seem necessary, you can use `tmp_objdir_add_as_alternate()`
to register a temporary directory as an alternate. See the tmp-objdir.h
API for more convenience functions.

Thanks,
Taylor

  reply	other threads:[~2023-07-17 14:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17 10:48 Teach git-fetch(1) to use a quarantine directory Toon Claes
2023-07-17 14:06 ` Taylor Blau [this message]
2023-07-19  7:24   ` Patrick Steinhardt
2023-07-17 23:47 ` Jonathan Tan
2023-07-17 23:56 ` Junio C Hamano

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

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

  git send-email \
    --in-reply-to=ZLVK5nzVZU48uvYE@nand.local \
    --to=me@ttaylorr.com \
    --cc=git@vger.kernel.org \
    --cc=toon@iotcl.com \
    /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.
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 NNTP newsgroup(s).