Git v2.9.2 was released in a hurry to accomodate for platforms like Windows, where the `unsigned long` data type is 32-bit even for 64-bit setups. The quick fix was to simply disable all the testing with "absurd" future dates. However, we can do much better than that, as we already make use of 64-bit data types internally. There is no good reason why we should not use the same for timestamps. Hence, let's use uintmax_t for timestamps. Note: while the `time_t` data type exists and is meant to be used for timestamps, on 32-bit Linux it is *still* 32-bit. An earlier iteration used `time_t` for that reason, but it came with a few serious downsides: as `time_t` can be signed (and indeed, on Windows it is an int64_t), Git's expectation that 0 is the minimal value does no longer hold true, introducing its own set of interesting challenges. Besides, if we *can* handle far in the future timestamps (except for formatting them using the system libraries), it is more consistent to do so. The upside of using `uintmax_t` for timestamps is that we do a much better job to support far in the future timestamps across all platforms, including 32-bit ones. The downside is that those platforms that use a 32-bit `time_t` will barf when parsing or formatting those timestamps. This iteration has no new changes, only conflict resolutions necessary due to `master` introducing nearby changes. Maybe this iteration will be noticed enough to make it into `pu`? Changes since v2: - resolved merge conflicts while rebasing to the current `master` - fixed a bug where archive-zip.c's dos_time() was passing an uninitialized time_t to localtime() Johannes Schindelin (8): ref-filter: avoid using `unsigned long` for catch-all data type t0006 & t5000: prepare for 64-bit timestamps t0006 & t5000: skip "far in the future" test when time_t is too limited Specify explicitly where we parse timestamps Introduce a new "printf format" for timestamps Introduce a new data type for timestamps Abort if the system time cannot handle one of our timestamps Use uintmax_t for timestamps Documentation/technical/api-parse-options.txt | 8 +- archive-tar.c | 5 +- archive-zip.c | 11 ++- archive.h | 2 +- builtin/am.c | 4 +- builtin/blame.c | 14 ++-- builtin/fsck.c | 6 +- builtin/gc.c | 2 +- builtin/log.c | 4 +- builtin/merge-base.c | 2 +- builtin/name-rev.c | 6 +- builtin/pack-objects.c | 4 +- builtin/prune.c | 4 +- builtin/receive-pack.c | 14 ++-- builtin/reflog.c | 24 +++--- builtin/rev-list.c | 2 +- builtin/rev-parse.c | 2 +- builtin/show-branch.c | 4 +- builtin/worktree.c | 4 +- bundle.c | 4 +- cache.h | 14 ++-- commit.c | 18 ++-- commit.h | 2 +- config.c | 2 +- credential-cache--daemon.c | 12 +-- date.c | 113 ++++++++++++++------------ fetch-pack.c | 8 +- fsck.c | 2 +- git-compat-util.h | 9 ++ http-backend.c | 4 +- parse-options-cb.c | 4 +- pretty.c | 4 +- reachable.c | 9 +- reachable.h | 4 +- ref-filter.c | 22 ++--- reflog-walk.c | 8 +- refs.c | 14 ++-- refs.h | 8 +- refs/files-backend.c | 8 +- revision.c | 6 +- revision.h | 4 +- sha1_name.c | 6 +- t/helper/test-date.c | 18 ++-- t/helper/test-parse-options.c | 4 +- t/t0006-date.sh | 4 +- t/t5000-tar-tree.sh | 6 +- t/test-lib.sh | 3 + tag.c | 6 +- tag.h | 2 +- upload-pack.c | 8 +- vcs-svn/fast_export.c | 8 +- vcs-svn/fast_export.h | 4 +- vcs-svn/svndump.c | 2 +- wt-status.c | 2 +- 54 files changed, 256 insertions(+), 218 deletions(-) base-commit: 6a2c2f8d34fa1e8f3bb85d159d354810ed63692e Published-As: https://github.com/dscho/git/releases/tag/time_t-may-be-int64-v3 Fetch-It-Via: git fetch https://github.com/dscho/git time_t-may-be-int64-v3 Interdiff vs v2: diff --git a/archive-zip.c b/archive-zip.c index 4f715d40450..bb117a74d45 100644 --- a/archive-zip.c +++ b/archive-zip.c @@ -548,9 +548,14 @@ static void write_zip_trailer(const unsigned char *sha1) static void dos_time(timestamp_t *timestamp, int *dos_date, int *dos_time) { time_t time; - struct tm *t = localtime(&time); + struct tm *t; + if (date_overflows(*timestamp)) + die("Timestamp too large for this system: %"PRItime, time); + time = (time_t)*timestamp; + t = localtime(&time); *timestamp = time; + *dos_date = t->tm_mday + (t->tm_mon + 1) * 32 + (t->tm_year + 1900 - 1980) * 512; *dos_time = t->tm_sec / 2 + t->tm_min * 32 + t->tm_hour * 2048; -- 2.12.2.windows.2.406.gd14a8f8640f