git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: "Jan Krüger" <jk@jk.gs>,
	git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>
Subject: Re: [PATCH] gc: make --prune useful again by accepting an optional parameter
Date: Sat, 14 Feb 2009 22:33:02 +0100	[thread overview]
Message-ID: <200902142233.07190.trast@student.ethz.ch> (raw)
In-Reply-To: <alpine.DEB.1.00.0902141959060.10279@pacific.mpi-cbg.de>

[-- Attachment #1: Type: text/plain, Size: 2388 bytes --]

Johannes Schindelin wrote:
> With this patch, "git gc --no-prune" will not prune any loose (and
> dangling) object, and "git gc --prune=5.minutes.ago" will prune
> all loose objects older than 5 minutes.

Prompted by discussion on IRC, I just spent some time staring at the
code, and for the code part and FWIW,

  Acked-by: Thomas Rast <trast@student.ethz.ch>

Meaning that for all I can see, it handles every combination of
config, --prune and --no-prune correctly.

I have some non-code nits however:

> +--prune=<date>::
> +	Prune loose objects older than date (default is 2 weeks ago).
> +	This option is on by default.

This isn't really true; to the user, it defaults to the value of
'gc.pruneExpire'.  That this is done by defaulting the state of
--prune to 2 weeks ago is an implementation detail.

> +		{ OPTION_STRING, 0, "prune", &prune_expire, "date",
> +			"prune unreferenced objects (deprecated)",
> +			PARSE_OPT_OPTARG, NULL, (intptr_t)prune_expire },

You still call the option "deprecated" :-)

> diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh
[...]
> +test_expect_success 'gc --no-prune && gc --prune=<date>' '
> +
> +	before=$(git count-objects | sed "s/ .*//") &&
> +	BLOB=$(echo aleph_0 | git hash-object -w --stdin) &&
> +	BLOB_FILE=.git/objects/$(echo $BLOB | sed "s/^../&\//") &&
> +	test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
> +	test -f $BLOB_FILE &&
> +	test-chmtime =-$((86400*5001)) $BLOB_FILE &&
> +	git gc --no-prune &&
> +	test 1 = $(git count-objects | sed "s/ .*//") &&
> +	test -f $BLOB_FILE &&
> +	git gc --prune=5002.days.ago &&
> +	test 1 = $(git count-objects | sed "s/ .*//") &&
> +	test -f $BLOB_FILE &&
> +	git gc --prune=5000.days.ago &&
> +	test 0 = $(git count-objects | sed "s/ .*//") &&
> +	test ! -f $BLOB_FILE
> +
> +'
> +

I'm not a huge fan of such contiguous blocks, as a failure is harder
to pin to any of the several tests inside, especially with 'test' not
showing any output when it fails.

Also, it does test the interaction between having gc.pruneExpire set,
but passing --no-prune: the tests above leave gc.pruneExpire at
"2.days.ago".  This wasn't immediately obvious however, and you should
probably set the config again just in case someone decides to insert a
test with a different value.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2009-02-14 21:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-13 17:14 [PATCH] Documentation: pruning recipe for destructive filter-branch Thomas Rast
2009-02-14  1:07 ` Junio C Hamano
2009-02-14  1:51 ` Jan Krüger
2009-02-14  5:46   ` Johannes Schindelin
2009-02-14  6:49     ` Jan Krüger
2009-02-14 11:48       ` Johannes Schindelin
2009-02-14 14:22         ` [PATCH v2] " Thomas Rast
2009-02-14 19:12           ` Johannes Schindelin
2009-02-14 19:29           ` Junio C Hamano
2009-02-14 20:56             ` [PATCH v3] " Thomas Rast
2009-02-14 19:02       ` [PATCH] gc: make --prune useful again by accepting an optional parameter Johannes Schindelin
2009-02-14 21:33         ` Thomas Rast [this message]
2009-02-14 21:33         ` Jan Krüger
2009-02-14 22:05     ` Johannes Schindelin
2009-02-14 22:10       ` [PATCH v2] " Johannes Schindelin
2009-02-14 22:38         ` Thomas Rast
2009-02-15 19:33         ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2008-12-15 20:22 [PATCH] " Johannes Schindelin
2008-12-15 21:07 ` Brandon Casey
2008-12-15 21:17   ` Brandon Casey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200902142233.07190.trast@student.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jk@jk.gs \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).