Re: [PATCH v3] gc: call "prune --expire 2.weeks.ago" by default

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



... and here is the interdiff:

 builtin-gc.c     |    3 ++-
 t/t5304-prune.sh |   10 +++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/builtin-gc.c b/builtin-gc.c
index 8d07350..9663fae 100644
--- a/builtin-gc.c
+++ b/builtin-gc.c
@@ -59,7 +59,8 @@ static int gc_config(const char *var, const char *value)
 	if (!strcmp(var, "gc.pruneexpire")) {
 		if (!value)
 			return config_error_nonbool(var);
-		if (!approxidate(value))
+		if (strcmp(value, "now") &&
+				approxidate(value) - approxidate("now") >= 0)
 			return error("Invalid gc.pruneExpire: '%s'", value);
 		prune_expire = xstrdup(value);
 		return 0;
diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh
index 2a88b3f..3b6b01d 100644
--- a/t/t5304-prune.sh
+++ b/t/t5304-prune.sh
@@ -50,7 +50,6 @@ test_expect_success 'gc: implicit prune --expire' '
 
 	before=$(git count-objects | sed "s/ .*//") &&
 	BLOB=$(echo aleph_0 | git hash-object -w --stdin) &&
-echo blob: $BLOB &&
 	BLOB_FILE=.git/objects/$(echo $BLOB | sed "s/^../&\//") &&
 	test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
 	test -f $BLOB_FILE &&
@@ -65,4 +64,13 @@ echo blob: $BLOB &&
 
 '
 
+test_expect_success 'gc: refuse to start with invalid gc.pruneExpire' '
+
+	git config gc.pruneExpire invalid &&
+	test_must_fail git gc &&
+	git config gc.pruneExpire now &&
+	git gc
+
+'
+
 test_done

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux