git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Olivier Marin <dkr+ml.git@free.fr>
To: Git Mailing List <git@vger.kernel.org>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Junio C Hamano <gitster@pobox.com>
Subject: Bug with approxidate("never")?
Date: Mon, 16 Jun 2008 01:20:44 +0200	[thread overview]
Message-ID: <4855A3CC.2090701@free.fr> (raw)

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 &&

             reply	other threads:[~2008-06-15 23:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-15 23:20 Olivier Marin [this message]
2008-06-17 16:34 ` [PATCH] Fix approxidate("never") to always return 0 Olivier Marin
2008-06-18 15:06   ` Johannes Schindelin

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=4855A3CC.2090701@free.fr \
    --to=dkr+ml.git@free.fr \
    --cc=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).