From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Alex Riesen <raa.lkml@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] Make reflog query '@{1219188291}' act as '@{2008/08/19 16:24:51}'
Date: Thu, 21 Aug 2008 08:40:44 -0700 [thread overview]
Message-ID: <20080821154044.GU3483@spearce.org> (raw)
In-Reply-To: <7vhc9fnxa1.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
> "Shawn O. Pearce" <spearce@spearce.org> writes:
>
> > I was just trying to be cute by using the original commit timestamp
> > of Git itself. Perhaps 12936648 (1TB / 83)?
>
> Well, reverse psychology did not quite work, I guess, so I'd ask more
> directly. Why not re-send with an update to the same 8-digit rule we use
> elsewhere?
--8<--
Make reflog query '@{1219188291}' act as '@{2008.8.19.16.24.51}'
As we support seconds-since-epoch in $GIT_COMMITTER_TIME we should
also support it in a reflog @{...} style notation. We can easily
tell this part from @{nth} style notation by looking to see if the
value is unreasonably large for an @{nth} style notation.
The value 100000000 was chosen as it is already used by date.c to
disambiguate yyyymmdd format from a seconds-since-epoch time value.
A reflog with 100,000,000 record entries is also simply not valid.
Such a reflog would require at least 7.7 GB to store just the old
and new SHA-1 values. So our randomly chosen upper limit for @{nth}
notation is "big enough".
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
sha1_name.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/sha1_name.c b/sha1_name.c
index 4fb77f8..41b6809 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -349,7 +349,10 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
else
nth = -1;
}
- if (0 <= nth)
+ if (100000000 <= nth) {
+ at_time = nth;
+ nth = -1;
+ } else if (0 <= nth)
at_time = 0;
else {
char *tmp = xstrndup(str + at + 2, reflog_len);
--
1.6.0.112.g9c75
--
Shawn.
prev parent reply other threads:[~2008-08-21 15:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-19 23:44 [PATCH] Make reflog query '@{1219188291}' act as '@{2008/08/19 16:24:51}' Shawn O. Pearce
2008-08-19 23:57 ` Junio C Hamano
2008-08-20 0:03 ` Shawn O. Pearce
2008-08-20 19:35 ` Alex Riesen
2008-08-20 19:44 ` Shawn O. Pearce
2008-08-20 19:54 ` Alex Riesen
2008-08-20 20:00 ` Shawn O. Pearce
2008-08-20 20:09 ` Alex Riesen
2008-08-20 22:20 ` Junio C Hamano
2008-08-21 15:40 ` Shawn O. Pearce [this message]
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=20080821154044.GU3483@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=raa.lkml@gmail.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).