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

Re: problem with modification time of packfiles

From
Jeff King <peff@peff.net>
Date
Oct 19, 2015, 23:52 UTC
Message-ID
<20151019235230.GA14800@sigill.intra.peff.net>
In-Reply-To
<20151019230919.GA60184@vauxhall.crustytoothpaste.net>
On Mon, Oct 19, 2015 at 11:09:19PM +0000, brian m. carlson wrote:
Show 18 quoted lines
> On Mon, Oct 19, 2015 at 08:59:15PM +0100, Andreas Amann wrote:
> > Thank you for your answer.  However, this reasoning only applies to loose
> > objects and not packfiles.
> > 
> > My understanding is that "git prune" will not prune any pack files
> > (except those starting with tmp_).  Only "git repack" should do that.
> > Repack seems to be however mtime agnostic and therefore it does not seem
> > to be necessary to freshen packfiles.
> > 
> > It therefore seems that git freshens packfiles unnecessarily, which can
> > lead to expensive and unnecessary backup operations.
> > 
> > Given this, would a trivial patch to remove the freshening of packfiles
> > be acceptable?
> 
> I'm not familiar enough with the code to say for certain, but it looks
> like you're right.  Peff, Junio, do you think this is safe, or is there
> something we're missing?

No, it's not safe. When doing a full repack, we pack only reachable objects. Unreachable ones are either loosened and given the mtime of the packfile (from which they can then be pruned), or discarded if the pack mtime is already old (as an optimization to avoid writing and then immediately pruning).

See builtin/pack-objects.c:loosen_unused_packed_objects.
-Peff
Previous: brian m. carlson
Message 5 of 5 in “problem with modification time of packfiles”
  1. Andreas AmannOct 18, 2015
  2. brian m. carlsonOct 19, 2015
  3. Andreas AmannOct 19, 2015
  4. brian m. carlsonOct 19, 2015
  5. Jeff KingOct 19, 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.