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

Bug with approxidate("never")?

From
OMOlivier Marin <dkr+ml.git@free.fr>
Date
Jun 15, 2008, 23:20 UTC
Message-ID
<4855A3CC.2090701@free.fr>
Hi,

While I was playing in the stash area and with "reflog expire" I was surprised by the fact that "never" is not always never. For example, approxidate("never") returns 4294960096 for my timezone (CET-2), it loops with all negative timezones.

I fixed it by replacing date_never() with this one:
static void date_never(struct tm *tm, int *num)
{
        time_t n = 0;
        localtime_r(&n, tm);
}
but I not sure this is the right fix. Better idea?

If you want to try yourself, the following test case should trigger the problem.

diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh
index 73f830d..b07d7bd 100755
--- a/t/t1410-reflog.sh
+++ b/t/t1410-reflog.sh
@@ -158,6 +158,17 @@ test_expect_success 'reflog expire' '
        check_fsck "dangling commit $K"
 '
 
+test_expect_success 'reflog expire --expire=never' '
+
+       TZ=CET-2 &&
+       git reflog expire --expire=never \
+               --stale-fix \
+               --all &&
+
+       loglen=$(wc -l <.git/logs/refs/heads/master) &&
+       test $loglen = 2
+'
+
 test_expect_success 'prune and fsck' '
 
        git prune &&
Next: Olivier Marin
Message 1 of 3 in “Bug with approxidate("never")?”
  1. Olivier MarinJun 15, 2008
  2. Fix approxidate("never") to always return 0Olivier Marin, Jun 17, 2008
  3. Johannes SchindelinJun 18, 2008

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.