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

Re: Fetching everything in another bare repo

From
Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Date
Mar 9, 2023, 17:57 UTC
Message-ID
<20230309175718.j5c2dbx3asphiqhu@meerkat.local>
In-Reply-To
<ZAn80gnIFLOF4Gco@coredump.intra.peff.net>
On Thu, Mar 09, 2023 at 10:35:46AM -0500, Jeff King wrote:
Show 27 quoted lines
> You may want to try the "preciousObjects" repository extension, which
> was designed to prevent accidents for a case like this. Something like:
> 
>   [this will cause old versions of Git that don't understand
>    extensions.* to bail on all commands for safety]
>   $ git config core.repositoryformatversion 1
> 
>   [this will tell old versions of Git that don't understand this
>    particular extension to bail on all commands for safety. But more
>    importantly, it will tell recent versions (> 2.6.3) to allow most
>    commands, but not ones that would delete unreachable objects]
>   $ git config extensions.preciousObjects true
> 
>   [this is it in action]
>   $ git repack -ad
>   fatal: cannot delete packs in a precious-objects repo
>   $ git prune
>   fatal: cannot prune in a precious-objects repo
> 
> Sadly it's not quite smart enough to realize that "git repack -adk" is
> safe. If you want to occasionally repack with that, you'd have to
> manually disable the flag for a moment.
> 
> I will also say that while I implemented this extension a while back, it
> never actually saw production use for my intended case. So I think it's
> pretty good (and certainly safer than nothing), but it's not thoroughly
> tested in the wild.

We use it in grokmirror for objstore repositories [1] (the super-parents of all forks), as a precautionary measure against a sysadmin running any kind of manual operation that may result in loose objects being deleted. I do believe it works well for that purpose.

-K
[1] https://github.com/mricon/grokmirror#object-storage-repositories
Previous: Jeff KingNext: Jeff King
Message 5 of 7 in “Fetching everything in another bare repo”
  1. Paul SmithMar 8, 2023
  2. Jeff KingMar 9, 2023
  3. Paul SmithMar 9, 2023
  4. Jeff KingMar 9, 2023
  5. Konstantin RyabitsevMar 9, 2023
  6. Jeff KingMar 10, 2023
  7. Paul SmithMar 9, 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.