From: Adam Simpkins <simpkins@facebook.com>
To: <git@vger.kernel.org>, <gitster@pobox.com>
Cc: Adam Simpkins <simpkins@facebook.com>
Subject: [PATCH 2/3] reflog: honor gc.reflogexpire=never
Date: Fri, 26 Feb 2010 19:50:03 -0800 [thread overview]
Message-ID: <1267242604-5215-2-git-send-email-simpkins@facebook.com> (raw)
In-Reply-To: <1267242604-5215-1-git-send-email-simpkins@facebook.com>
Previously, if gc.reflogexpire or gc.reflogexpire were set to "never"
or "false", the builtin default values were used instead.
Signed-off-by: Adam Simpkins <simpkins@facebook.com>
---
builtin-reflog.c | 6 ++----
t/t1410-reflog.sh | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/builtin-reflog.c b/builtin-reflog.c
index 7498210..64e45bd 100644
--- a/builtin-reflog.c
+++ b/builtin-reflog.c
@@ -530,16 +530,14 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
int i, status, do_all;
int explicit_expiry = 0;
+ default_reflog_expire_unreachable = now - 30 * 24 * 3600;
+ default_reflog_expire = now - 90 * 24 * 3600;
git_config(reflog_expire_config, NULL);
save_commit_buffer = 0;
do_all = status = 0;
memset(&cb, 0, sizeof(cb));
- if (!default_reflog_expire_unreachable)
- default_reflog_expire_unreachable = now - 30 * 24 * 3600;
- if (!default_reflog_expire)
- default_reflog_expire = now - 90 * 24 * 3600;
cb.expire_total = default_reflog_expire;
cb.expire_unreachable = default_reflog_expire_unreachable;
diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh
index 80af6b9..25046c4 100755
--- a/t/t1410-reflog.sh
+++ b/t/t1410-reflog.sh
@@ -214,4 +214,45 @@ test_expect_success 'delete' '
'
+test_expect_success 'rewind2' '
+
+ test_tick && git reset --hard HEAD~2 &&
+ loglen=$(wc -l <.git/logs/refs/heads/master) &&
+ test $loglen = 4
+
+'
+
+test_expect_success '--expire=never' '
+
+ git reflog expire --verbose \
+ --expire=never \
+ --expire-unreachable=never \
+ --all &&
+ loglen=$(wc -l <.git/logs/refs/heads/master) &&
+ test $loglen = 4
+
+'
+
+test_expect_success 'gc.reflogexpire=never' '
+
+ git config gc.reflogexpire never &&
+ git config gc.reflogexpireunreachable never &&
+ git reflog expire --verbose --all &&
+ loglen=$(wc -l <.git/logs/refs/heads/master) &&
+ test $loglen = 4
+'
+
+test_expect_success 'gc.reflogexpire=false' '
+
+ git config gc.reflogexpire false &&
+ git config gc.reflogexpireunreachable false &&
+ git reflog expire --verbose --all &&
+ loglen=$(wc -l <.git/logs/refs/heads/master) &&
+ test $loglen = 4 &&
+
+ git config --unset gc.reflogexpire &&
+ git config --unset gc.reflogexpireunreachable
+
+'
+
test_done
--
1.6.3.3
next prev parent reply other threads:[~2010-02-27 3:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-26 21:59 [PATCH] prune: honor --expire=never Adam Simpkins
2010-02-27 0:07 ` Junio C Hamano
2010-02-27 1:21 ` Adam Simpkins
2010-02-27 3:50 ` [PATCH 1/3] " Adam Simpkins
2010-02-27 3:50 ` Adam Simpkins [this message]
2010-02-27 3:50 ` [PATCH 3/3] clean up parsing of expiration dates Adam Simpkins
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=1267242604-5215-2-git-send-email-simpkins@facebook.com \
--to=simpkins@facebook.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).