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

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

From
Jeff King <peff@peff.net>
Date
Jun 25, 2015, 10:07 UTC
Message-ID
<20150625100737.GA26795@peff.net>
In-Reply-To
<xmqqvbed9gf7.fsf@gitster.dls.corp.google.com>
On Wed, Jun 24, 2015 at 10:15:08AM -0700, Junio C Hamano wrote:
Show 11 quoted lines
> > 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.
My assumption was that people fall into one of two categories:
  - people who just run `git gc`
  - people who are doing something clever, and will use `git
    repack` to do a full repack after making sure it is safe to do so.
    E.g., after "clone -s", it might be OK to do:
      for i in ../*.git; do
        git fetch $i +refs/*:refs/remotes/$i/*
      done
      git -c extensions.preciousObjects=false repack -ad
    But only the user can make that decision; git does not know whether
    "../*.git" is the complete set of children.

Certainly "git repack -a" is a safe stopgap in the shared-object parent, but eventually you will want to do the clever thing. :)

I think it is OK to use this patch as a starting point, and for people to loosen the rules later if there is a combination of repack flags that are safe to run but not covered by the current logic (there is no regression, since preciousObjects is a new extension, and going forward it is OK to allow new safe things to open up workflows, but not the other way around).

It may even be that the current patch even allows any sane workflow; I am only claiming that I did not think too hard on it, and tried to err on the side of safety, and allowing the workflow above.

-Peff
Previous: Junio C HamanoNext: David Turner
Message 9 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.