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

Re: [PATCH] prune: --expire=time

From
Junio C Hamano <junkio@cox.net>
Date
Jan 22, 2007, 02:03 UTC
Message-ID
<7v1wlnyfzr.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<45B415B1.30407@midwinter.com>
Steven Grimm <koreth@midwinter.com> writes:
> Shouldn't the repository be locked against operations like prune while
> a commit is in progress anyway? That seems like it's pretty prudent
> and reasonable to me -- doing otherwise is just asking for a zillion
> little race conditions.

The primary problem is not "while a commit is in progress" anyway. I do not think of a single sane reason to run git-prune from a cron job in a repository that is used for an active development. It would make sense for management types to run count-objects from a cron job and yell at offenders to repack, but even then the primary disk saving and performance enhancement would come from repacking and not from pruning. Especially, 1.5.0 and onwards the objects reachable from reflog are protected from pruning and reflogs are enabled by default for developer repositories with working trees, even rewind and rebae would not create crufts (the only two exceptions that create cruft are running "git add" more than once on the same file between commits to leak blobs and intermediate tree objects recursive merge needs to make when there are more than one common ancestors).

It is a possibility to have a single timestamp file that any command that intends to eventually update refs should touch before it starts creating any object. Then prune can stat the file and remember its timestamp before it starts reading the refs, and then before starting to actually prune the objects it can stat the file again and if the timestamp is different it can abort. Commit, receive-pack (invoked by git-push from the remote side), fetch-pack (invoked by clone, fetch and pull), etc. all needs to touch the file upfront before they create even a single object. But that would create a very hot spot on the filesystem, and I am not sure what its ramifications are.

My take on this issue is rather different. I do agree with you that prune is a rare enough operation, and I think it should not penalize the primary thing developers would want to do many times an hour. I think its much simpler and saner to teach people not to run prune in an uncontrolled way.

We may want to remove the call to git-prune from git-gc, and tell people that if they want to run something from a cron job, run git-gc and not git-prune.

Previous: Jeff KingNext: Simon 'corecode' Schubert
Message 29 of 30 in “prune-packed: new option --min-age=N”
  1. prune-packed: new option --min-age=NMatthias Lederhofer, Jan 18, 2007
  2. Shawn O. PearceJan 18, 2007
  3. Matthias LederhoferJan 18, 2007
  4. Shawn O. PearceJan 18, 2007
  5. [RFC] prune: --expire=secondsMatthias Lederhofer, Jan 18, 2007
  6. Junio C HamanoJan 18, 2007
  7. Shawn O. PearceJan 19, 2007
  8. prune: --expire=timeMatthias Lederhofer, Jan 19, 2007
  9. Nicolas PitreJan 19, 2007
  10. Junio C HamanoJan 19, 2007
  11. Matthias LederhoferJan 20, 2007
  12. Junio C HamanoJan 21, 2007
  13. Shawn O. PearceJan 21, 2007
  14. Matthias LederhoferJan 21, 2007
  15. Junio C HamanoJan 21, 2007
  16. Jeff KingJan 21, 2007
  17. Steven GrimmJan 22, 2007
  18. Jeff KingJan 22, 2007
  19. Junio C HamanoJan 22, 2007
  20. Linus TorvaldsJan 22, 2007
  21. Junio C HamanoJan 22, 2007
  22. Linus TorvaldsJan 22, 2007
  23. Junio C HamanoJan 22, 2007
  24. Linus TorvaldsJan 22, 2007
  25. Shawn O. PearceJan 22, 2007
  26. Junio C HamanoJan 22, 2007
  27. Jakub NarebskiJan 22, 2007
  28. v1.5.0.txt: update description of git-gcJeff King, Jan 22, 2007
  29. Junio C HamanoJan 22, 2007
  30. Simon 'corecode' SchubertJan 20, 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.