{"thread":{"id":"9206","subject":"[PATCH] Teach approxidate() to understand \"never\"","startedAt":"2007-07-24T18:18:34Z","lastAt":"2007-07-24T18:18:34Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"48495","messageId":"Pine.LNX.4.64.0707241917130.14781@racer.site","threadId":"9206","inReplyTo":null,"subject":"[PATCH] Teach approxidate() to understand \"never\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-24T18:18:34Z","receivedAt":"2007-07-24T18:18:34Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nIf you want to keep the reflogs around for a really long time, you should be\nable to say so:\n\n\t$ git config gc.reflogExpire never\n\nNow it works, too.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tGuess how surprised I was when \"gc.reflogExpire = never\" triggered \n\ta pruning of _all_ reflogs!  Happily, this was only in a test \n\tenvironment.\n\n\tAnother strange thing there is this:  As an alternative, I set\n\treflogExpire to \"1970\", which git interpreted as \"now\" (just like \n\t\"never\", before this patch).  Another alternative was even worse: \n\t\"1 Jan 1970\".  Because I am at +0100 right now, the debugger said \n\tthis:\n\n\tBreakpoint 1, cmd_reflog_expire (argc=1, argv=0xbfb92968, prefix=0x0)\n\t    at builtin-reflog.c:307\n\t307             if (!default_reflog_expire_unreachable)\n\t(gdb) p show_date(default_reflog_expire, 0, 0)\n\t$3 = 0x8113560 \"Wed Dec 31 23:00:00 1969 +0000\"\n\t(gdb) p default_reflog_expire\n\t$4 = 4294963696\n\n\tIOW, if I had not looked at the timestamp, I would have thunk \n\teverything is fine, while \"git reflog expire\" again would have \n\tmerrily removed _every_ reflog.\n\n date.c |    7 +++++++\n 1 files changed, 7 insertions(+), 0 deletions(-)\n\ndiff --git a/date.c b/date.c\nindex 45b0b1d..59fe4f8 100644\n--- a/date.c\n+++ b/date.c\n@@ -660,6 +660,12 @@ static void date_am(struct tm *tm, int *num)\n \ttm->tm_hour = (hour % 12);\n }\n \n+static void date_never(struct tm *tm, int *num)\n+{\n+\ttm->tm_year = tm->tm_mon = tm->tm_mday = tm->tm_wday = tm->tm_yday\n+\t\t= tm->tm_hour = tm->tm_min = tm->tm_sec = 0;\n+}\n+\n static const struct special {\n \tconst char *name;\n \tvoid (*fn)(struct tm *, int *);\n@@ -670,6 +676,7 @@ static const struct special {\n \t{ \"tea\", date_tea },\n \t{ \"PM\", date_pm },\n \t{ \"AM\", date_am },\n+\t{ \"never\", date_never },\n \t{ NULL }\n };\n \n-- \n1.5.3.rc2.42.gda8d\n"}]}