git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Teach git-fetch(1) to use a quarantine directory

From
Taylor Blau <me@ttaylorr.com>
Date
Jul 17, 2023, 14:06 UTC
Message-ID
<ZLVK5nzVZU48uvYE@nand.local>
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?

Show 10 quoted lines
> 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

Previous: Toon ClaesNext: Patrick Steinhardt
Message 2 of 5 in “Teach git-fetch(1) to use a quarantine directory”
  1. Toon ClaesJul 17, 2023
  2. Taylor BlauJul 17, 2023
  3. Patrick SteinhardtJul 19, 2023
  4. Jonathan TanJul 17, 2023
  5. Junio C HamanoJul 17, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.