From: Junio C Hamano Date: Sun, 21 Jan 2007 06:55:42 GMT Subject: Re: [PATCH] prune: --expire=time Message-ID: <7vlkjw50nl.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <20070120111832.GA30368@moooo.ath.cx> Matthias Lederhofer writes: > Junio C Hamano wrote: >... >> Maybe an alternative: >> >> git prune --retain=1.day >> git prune --retain=off >> >> perhaps? I dunno. > > Perhaps we could also use 'none' or 'all, e.g. --retain=none or > --expire=all. I am considering to commit the attached instead. The command "prune" is about expiring loose objects that are unreachable, and the option introduces a grace period for the expiration process. Other places that we do use the word 'expire' to specify the time do mean the expiration timeout. As long as you do not rewind/rebase too much, there is not much you can gain from 'git-prune' ('git-repack -a -d' would give you much more disk savings and performance gain). I do not think it makes sense to run uncontrolled 'git-prune' from automated cron jobs. Even if you rewind/rebase often, 1.5.0 will protect the objects reflog entries refer to, so there will be even less to be gained from 'git-prune'. I am having a feeling that it might even make sense not to run 'git-prune' from 'git-gc'. While I sympathize with what Simon says to certain degree, I tend to think the complication it needs to introduce is really not worth it. Perfect is the enemy of the good. By the way. While updating the documentation, I noticed that we lost the 'extra heads' support when git-prune was rewritten as a built-in in commit ba84a797 (July 6th 2006). The example (commented out in the patch) is a valid way to safely prune a repository whose objects are borrowed via the alternates mechanism by some other repository, albeit not really scalable. The way we might want to address this would be when 'clone -s' makes a new repository that borrows from an existing repository, we could make a symlink under .git/refs/borrowers/ in the original repository that points at .git/refs directory of the cloned repository -- you can do that by hand today and it would be much nicer than having to specify the other repository when running 'git prune' as the example suggests. For this reason, I would say losing that 'extra heads' support from git-prune, which happened half year ago, was Ok. So far, we have been telling not to rewind refs in repositories whose objects are borrowed by other repositories via the alternates mechanism, and I think that advice is still a very reasonable one to give, but we probably should make it more prominent. As long as we do that, we would not even need the 'refs/borrowers/*' symlinks. -- >8 -- From: Matthias Lederhofer [PATCH] prune: --grace=time This option gives grace period to objects that are unreachable from the refs from getting pruned. The default value is 24 hours and may be changed using gc.prunegrace. Signed-off-by: Matthias Lederhofer Signed-off-by: Junio C Hamano --- Documentation/git-prune.txt | 9 ++++++++- builtin-prune.c | 31 ++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/Documentation/git-prune.txt b/Documentation/git-prune.txt index a11e303..fbd344d 100644 --- a/Documentation/git-prune.txt +++ b/Documentation/git-prune.txt @@ -8,7 +8,7 @@ git-prune - Prunes all unreachable objects from the object database SYNOPSIS -------- -'git-prune' [-n] [--] [...] +'git-prune' [-n] [--grace=