git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Teach approxidate() to understand "never"

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 24, 2007, 18:18 UTC
Message-ID
<Pine.LNX.4.64.0707241917130.14781@racer.site>

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
Message 1 of 1 in “Teach approxidate() to understand "never"”
  1. Teach approxidate() to understand "never"Johannes Schindelin, Jul 24, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.