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

Re: [PATCH 2/2] introduce "preciousObjects" repository extension

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 24, 2015, 17:15 UTC
Message-ID
<xmqqvbed9gf7.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20150624075019.GA827@peff.net>
Jeff King <peff@peff.net> writes:
Show 14 quoted lines
>> > +	if (delete_redundant && repository_format_precious_objects)
>> > +		die("cannot repack in a precious-objects repo");
>> 
>> This message initially threw me off during my cursory reading, but
>> the code tells me that this is only about "repack -d".
>> 
>> Unfortunately the users do not get the chance to read the code;
>> perhaps s/cannot repack/& -d/; or something?
>
> I agree that would be better. I originally just blocked all use of
> git-repack, but at the last minute softened it to just "repack -d". I'm
> not sure if that would actually help anyone in practice. Sure, doing
> "git repack" without any options is not destructive, but I wonder if
> anybody actually does it.

Hmph, if you cannot afford to lose objects that are unreachable from your refs (because you know your repository has borrowers) but are suffering from too many packs, wouldn't "repack -a" be the most natural thing to do? Maybe I am biased, but "git gc" is not the first thing that comes to my mind in that situation.

> So I think we could squash in the patch below (which also marks the
> strings for translation). But I'd also be OK with the rule covering all
> of `git repack`.
OK, will squash it in.
Show 37 quoted lines
> [1] One of my proposed uses for this is to revamp the way we handle
>     shared objects on GitHub servers. Right now objects get pushed to
>     individual forks, and then migrate to a shared repository that is
>     accessed via the alternates mechanism. I would like to move to
>     symlinking the `objects/` directory to write directly into the
>     shared space. But the destruction from accidentally running
>     something like `git gc` in a fork is very high. With this patch, we
>     can bump the forks to the v1 format and mark their objects as
>     precious.
>
> ---
> diff --git a/builtin/prune.c b/builtin/prune.c
> index fc0c8e8..6a58e75 100644
> --- a/builtin/prune.c
> +++ b/builtin/prune.c
> @@ -219,7 +219,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
>  	}
>  
>  	if (repository_format_precious_objects)
> -		die("cannot prune in a precious-objects repo");
> +		die(_("cannot prune in a precious-objects repo"));
>  
>  	while (argc--) {
>  		unsigned char sha1[20];
> diff --git a/builtin/repack.c b/builtin/repack.c
> index 8ae7fe5..3beda2c 100644
> --- a/builtin/repack.c
> +++ b/builtin/repack.c
> @@ -194,7 +194,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
>  				git_repack_usage, 0);
>  
>  	if (delete_redundant && repository_format_precious_objects)
> -		die("cannot repack in a precious-objects repo");
> +		die(_("cannot delete packs in a precious-objects repo"));
>  
>  	if (pack_kept_objects < 0)
>  		pack_kept_objects = write_bitmaps;
Previous: Jeff KingNext: Jeff King
Message 8 of 13 in “bumping repository format version”
  1. 0/2 bumping repository format versionJeff King, Jun 23, 2015
  2. 1/2 introduce "extensions" form of core.repositoryformatversionJeff King, Jun 23, 2015
  3. 2/2 introduce "preciousObjects" repository extensionJeff King, Jun 23, 2015
  4. Duy NguyenJun 23, 2015
  5. Jeff KingJun 23, 2015
  6. Junio C HamanoJun 23, 2015
  7. Jeff KingJun 24, 2015
  8. Junio C HamanoJun 24, 2015
  9. Jeff KingJun 25, 2015
  10. David TurnerJun 23, 2015
  11. Jeff KingJun 24, 2015
  12. Jeff KingJun 24, 2015
  13. Duy NguyenJun 24, 2015

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.