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

Re: When to repack?

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 31, 2007, 15:19 UTC
Message-ID
<Pine.LNX.4.63.0701311617360.22628@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<45C09335.6010601@op5.se>
Hi,
On Wed, 31 Jan 2007, Andreas Ericsson wrote:
Show 20 quoted lines
> Bill Lear wrote:
> > We have a company repo used by many people throughout the day.  When/how
> > can I repack this?  I have come to adopt this approach:
> > 
> > % mv project project.pack
> > % cd project.pack
> > % GIT_DIR=. git repack -a -d
> > % cd ..
> > % mv project.pack project
> > 
> 
> Renaming the directory isn't necessary. The packs won't be used until they
> have a .idx file. That .idx-file is written after the packfile, so any
> operations on the repo will simply use the old, loose, objects before the
> packing is completed.
> 
> The worst thing that can happen is that an object about to be fetched is
> deleted in its loose version before the upload-pack program can open it,
> but that's no worse than having the entire directory being moved out from
> under it.

AFAIR this case is handled gracefully by git. If the object it is still accessing moves to a(nother) pack, git will still find it.

> On a side-note, this is a grade A example of something that should 
> typically be done sunday night at 4am.

Actually, I'd recommend git-gc. It does not even call git-prune anymore, so there is no excuse.

I even do it interactively very often, and I just love the fact that "gc" is so much shorter than "repack -a -d", _plus_ it also does other cleanup tasks.

Ciao, Dscho

Previous: Andreas EricssonNext: Shawn O. Pearce
Message 4 of 5 in “When to repack?”
  1. Bill LearJan 31, 2007
  2. Jakub NarebskiJan 31, 2007
  3. Andreas EricssonJan 31, 2007
  4. Johannes SchindelinJan 31, 2007
  5. Shawn O. PearceJan 31, 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.