From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Brandon Casey <casey@nrlssc.navy.mil>,
Jakub Narebski <jnareb@gmail.com>, Nicolas Pitre <nico@cam.org>,
git@vger.kernel.org
Subject: Re: [PATCH v4] gc: call "prune --expire 2.weeks.ago" by default
Date: Thu, 13 Mar 2008 00:28:08 +0100 (CET) [thread overview]
Message-ID: <alpine.LSU.1.00.0803130021520.1656@racer.site> (raw)
In-Reply-To: <7vzlt335a5.fsf@gitster.siamese.dyndns.org>
Hi,
On Wed, 12 Mar 2008, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> >> Yuck; approxidate() returns ulong. Can subtracting a ulong from
> >> another ever go negative?
> >>
> >> Besides, because there is no guarantee of the order of evaluation
> >> between these two approxidate() calls, you may get +1 or -1 on the
> >> second boundary.
> >>
> >> I think the reason why you did not catch it in your test is because
> >> your tests are half complete; they test only what you wanted to catch
> >> (misconfigured case) and do not test the other half (properly working
> >> case).
> >
> > Yes, probably. Of course, comparing a difference to 0 is absolutely
> > moronic.
> >
> > I should have written
> >
> > approxidate(value) >= approxidate("now"))
> >
> > in the first place.
>
> Eh, sorry, but why?
The thing is: I want to prevent invalid dates in gc.pruneExpire from going
unnoticed, _especially_ since they would default to "now". IOW if you
said something like "one.weak.ago", it would actually have the same effect
as "now" and offer _no_ grace period.
But like you said, comparing the difference of two unsigned longs to >= 0
might be quite stupid. Instead, I compare them _directly_.
Since I compare the value to "now" first, and only if it is not, compare
the approxidate() of the value to the current time stamp, I can verify
that no invalid date was specified.
Unfortunately, this check includes future dates. Fortunately, they do not
make sense at all.
To make my reasoning clear, how about this comment above that if() clause?
/*
* In case of an invalid date, approxidate() returns the
* same as approxidate("now"). Since the millisecond
* boundary could have been crossed between the two calls
* to approxidate(), we compare not only for equality,
* but also if the former is greater than the latter.
*
* Note: this assumes that future dates are invalid, which
* makes sense, really.
*/
Hmm?
Ciao,
Dscho
next prev parent reply other threads:[~2008-03-12 23:28 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-11 20:58 [PATCH] gc: call "prune --expire 2.weeks.ago" Johannes Schindelin
2008-03-12 2:13 ` Junio C Hamano
2008-03-12 2:37 ` Nicolas Pitre
2008-03-12 6:49 ` Junio C Hamano
2008-03-12 10:57 ` Johannes Schindelin
2008-03-12 15:45 ` Nicolas Pitre
2008-03-12 15:53 ` Pieter de Bie
2008-03-12 16:05 ` Johannes Schindelin
2008-03-12 17:01 ` Jeff King
2008-03-12 22:50 ` Pieter de Bie
2008-03-12 23:20 ` Junio C Hamano
2008-03-12 23:30 ` Johannes Schindelin
2008-03-12 23:41 ` Junio C Hamano
2008-03-12 16:20 ` Geert Bosch
2008-03-12 15:07 ` Nicolas Pitre
2008-03-12 15:32 ` Marko Kreen
2008-03-12 17:35 ` [PATCH v2] gc: call "prune --expire 2.weeks.ago" by default Johannes Schindelin
2008-03-12 17:56 ` Brandon Casey
2008-03-12 18:35 ` Jakub Narebski
2008-03-12 19:07 ` Johannes Schindelin
2008-03-12 19:12 ` Junio C Hamano
2008-03-12 19:38 ` Johannes Schindelin
2008-03-12 19:53 ` [PATCH v3] " Johannes Schindelin
2008-03-12 19:55 ` Johannes Schindelin
2008-03-12 19:55 ` [PATCH v2] " Brandon Casey
2008-03-12 19:59 ` Johannes Schindelin
2008-03-12 20:25 ` Brandon Casey
2008-03-12 20:35 ` Junio C Hamano
2008-03-12 20:55 ` [PATCH v4] " Johannes Schindelin
2008-03-12 20:56 ` Johannes Schindelin
2008-03-12 21:20 ` Junio C Hamano
2008-03-12 22:40 ` Nicolas Pitre
2008-03-12 22:50 ` Johannes Schindelin
2008-03-12 23:13 ` Junio C Hamano
2008-03-12 23:28 ` Johannes Schindelin [this message]
2008-03-12 23:39 ` Junio C Hamano
2008-03-12 23:43 ` Johannes Schindelin
2008-03-13 9:48 ` Wincent Colaiuta
2008-03-13 10:17 ` Johannes Sixt
2008-03-13 9:21 ` Wincent Colaiuta
2008-03-13 11:11 ` 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=alpine.LSU.1.00.0803130021520.1656@racer.site \
--to=johannes.schindelin@gmx.de \
--cc=casey@nrlssc.navy.mil \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jnareb@gmail.com \
--cc=nico@cam.org \
/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).