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

Re: repo.or.cz wishes?

From
Shawn O. Pearce <spearce@spearce.org>
Date
Aug 31, 2007, 21:09 UTC
Message-ID
<20070831210938.GC18160@spearce.org>
In-Reply-To
<20070829111345.GD29615@thunk.org>
Theodore Tso <tytso@mit.edu> wrote:
Show 14 quoted lines
> On Wed, Aug 29, 2007 at 12:15:23AM -0400, Shawn O. Pearce wrote:
> > > 
> > > git --git-dir=A gc
> > > ln A/.git/objects/pack/* B/.git/objects/pack
> > > git --git-dir=B gc --prune
> > > git --git-dir=A prune
> > 
> > No, it won't work.
> > 
> > The problem is that during the first `git --git-dir=A gc` call
> > you are deleting packfiles that may contain objects that B needs.
> > *poof*.  
> 
> But "git-gc" without the --prune doesn't delete any objects.

Yes, it does delete objects. Even without --prune. That is because git-gc is running `git-repack -a -d -l`. repack -a means repack all objects reachable from the current refs. The -d means delete the packfiles that existed when the repack started, as it is assumed that all needed (reachable) objects were copied into the new output packfile(s). The -d also means delete any loose objects that are now packed (git-prune-packed).

Yet there may be objects in A that A cannot reach anymore (deleted or rewound branch) but that B needs and B does not have a copy of. If these objects were in one of the prior packfiles of A and is not in the new packfile(s) of A then those objects are gone. *poof*.

Show 7 quoted lines
> So it
> should always be safe to use git-gc even if there are repositories
> that are relying on that repo's ODB.  It's only if you use git-gc
> --prune that you could get in troudble.  It might delete some
> packfiles containing objects needed by B, but only after consolidating
> all of the objects into a single packfile that contains all of the
> objects that had always been in A's ODB.
But when we repack we don't repack everything in A's ODB, we only
repack the things that A can reach.  If A cannot reach something
because a branch was rewound or deleted it won't survive the repack.
Then the repack is behaving like at least partially like gc --prune.
 
> So I don't see why this wouldn't work.

It only works if A cannot delete a branch or rewind a branch. In other words, once an object is stored in A's ODB it must always be reachable from A's refs.

-- 
Shawn.
Previous: Theodore TsoNext: Linus Torvalds
Message 26 of 28 in “repo.or.cz wishes?”
  1. Petr BaudisAug 26, 2007
  2. Sven VerdoolaegeAug 27, 2007
  3. Petr BaudisAug 27, 2007
  4. Linus TorvaldsAug 27, 2007
  5. Junio C HamanoAug 27, 2007
  6. Matthieu MoyAug 27, 2007
  7. Martin MaresAug 27, 2007
  8. Jing XueAug 27, 2007
  9. Linus TorvaldsAug 27, 2007
  10. Sam VilainAug 27, 2007
  11. Linus TorvaldsAug 27, 2007
  12. Jakub NarebskiAug 27, 2007
  13. Linus TorvaldsAug 27, 2007
  14. Sam VilainAug 27, 2007
  15. Linus TorvaldsAug 27, 2007
  16. Jakub NarebskiAug 27, 2007
  17. Jakub NarebskiAug 27, 2007
  18. Sam VilainAug 27, 2007
  19. Johannes SchindelinAug 27, 2007
  20. Uwe Kleine-KönigAug 27, 2007
  21. Sven VerdoolaegeAug 29, 2007
  22. Jakub NarebskiAug 29, 2007
  23. Petr BaudisAug 29, 2007
  24. Petr BaudisAug 29, 2007
  25. Theodore TsoAug 29, 2007
  26. Shawn O. PearceAug 31, 2007
  27. Linus TorvaldsAug 29, 2007
  28. Shawn O. PearceSep 1, 2007

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.