@matheusbsbs / matheus-bagliano / commits / ea360dd053
Fork 0

Make reflog query '@{1219188291}' act as '@{2008.8.19.16:24:51.-0700}'

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Shawn O. Pearce committed Aug 21, 2008 at 08:40 UTC ea360dd0538d03d25f512efe2f100beb3e7c2130
1 file changed +4 -1
sha1_name.c
+4 -1
@@ -349,7 +349,10 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
349 else
350 nth = -1;
351 }
352 - if (0 <= nth)
352 + if (100000000 <= nth) {
353 + at_time = nth;
354 + nth = -1;
355 + } else if (0 <= nth)
356 at_time = 0;
357 else {
358 char *tmp = xstrndup(str + at + 2, reflog_len);