From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: git@vger.kernel.org, gitster@pobox.com
Subject: [PATCH] Teach approxidate() to understand "never"
Date: Tue, 24 Jul 2007 19:18:34 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0707241917130.14781@racer.site> (raw)
If you want to keep the reflogs around for a really long time, you should be
able to say so:
$ git config gc.reflogExpire never
Now it works, too.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
Guess how surprised I was when "gc.reflogExpire = never" triggered
a pruning of _all_ reflogs! Happily, this was only in a test
environment.
Another strange thing there is this: As an alternative, I set
reflogExpire to "1970", which git interpreted as "now" (just like
"never", before this patch). Another alternative was even worse:
"1 Jan 1970". Because I am at +0100 right now, the debugger said
this:
Breakpoint 1, cmd_reflog_expire (argc=1, argv=0xbfb92968, prefix=0x0)
at builtin-reflog.c:307
307 if (!default_reflog_expire_unreachable)
(gdb) p show_date(default_reflog_expire, 0, 0)
$3 = 0x8113560 "Wed Dec 31 23:00:00 1969 +0000"
(gdb) p default_reflog_expire
$4 = 4294963696
IOW, if I had not looked at the timestamp, I would have thunk
everything is fine, while "git reflog expire" again would have
merrily removed _every_ reflog.
date.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/date.c b/date.c
index 45b0b1d..59fe4f8 100644
--- a/date.c
+++ b/date.c
@@ -660,6 +660,12 @@ static void date_am(struct tm *tm, int *num)
tm->tm_hour = (hour % 12);
}
+static void date_never(struct tm *tm, int *num)
+{
+ tm->tm_year = tm->tm_mon = tm->tm_mday = tm->tm_wday = tm->tm_yday
+ = tm->tm_hour = tm->tm_min = tm->tm_sec = 0;
+}
+
static const struct special {
const char *name;
void (*fn)(struct tm *, int *);
@@ -670,6 +676,7 @@ static const struct special {
{ "tea", date_tea },
{ "PM", date_pm },
{ "AM", date_am },
+ { "never", date_never },
{ NULL }
};
--
1.5.3.rc2.42.gda8d
reply other threads:[~2007-07-24 18:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=Pine.LNX.4.64.0707241917130.14781@racer.site \
--to=johannes.schindelin@gmx.de \
--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).