t0006 & t5000: skip "far in the future" test when time_t is too limited

Git's source code refers to timestamps as unsigned long, which is ill-defined, as there is no guarantee about the number of bits that data type has. In preparation of switching to another data type that is large enough to hold "far in the future" dates, we need to prepare the t0006-date.sh script for the case where we *still* cannot format those dates if the system library uses 32-bit time_t. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Apr 20, 2017 at 22:58 UTC efac8ac84b8802d654d517468dbe822273b316df
4 files changed +8 -4
t/helper/test-date.c
+4 -1
@@ -5,7 +5,8 @@ static const char *usage_msg = "\n"
5 " test-date show:<format> [time_t]...\n"
6 " test-date parse [date]...\n"
7 " test-date approxidate [date]...\n"
8 -" test-date is64bit\n";
8 +" test-date is64bit\n"
9 +" test-date time_t-is64bit\n";
10
11 static void show_relative_dates(const char **argv, struct timeval *now)
12 {
@@ -96,6 +97,8 @@ int cmd_main(int argc, const char **argv)
97 parse_approxidate(argv+1, &now);
98 else if (!strcmp(*argv, "is64bit"))
99 return sizeof(unsigned long) == 8 ? 0 : 1;
100 + else if (!strcmp(*argv, "time_t-is64bit"))
101 + return sizeof(time_t) == 8 ? 0 : 1;
102 else
103 usage(usage_msg);
104 return 0;
t/t0006-date.sh
+2 -2
@@ -53,8 +53,8 @@ check_show unix-local "$TIME" '1466000000'
53
54 # arbitrary time absurdly far in the future
55 FUTURE="5758122296 -0400"
56 -check_show iso "$FUTURE" "2152-06-19 18:24:56 -0400" TIME_IS_64BIT
57 -check_show iso-local "$FUTURE" "2152-06-19 22:24:56 +0000" TIME_IS_64BIT
56 +check_show iso "$FUTURE" "2152-06-19 18:24:56 -0400" TIME_IS_64BIT,TIME_T_IS_64BIT
57 +check_show iso-local "$FUTURE" "2152-06-19 22:24:56 +0000" TIME_IS_64BIT,TIME_T_IS_64BIT
58
59 check_parse() {
60 echo "$1 -> $2" >expect
t/t5000-tar-tree.sh
+1 -1
@@ -402,7 +402,7 @@ test_expect_success TIME_IS_64BIT 'generate tar with future mtime' '
402 git archive HEAD >future.tar
403 '
404
405 -test_expect_success TAR_HUGE,TIME_IS_64BIT 'system tar can read our future mtime' '
405 +test_expect_success TAR_HUGE,TIME_IS_64BIT,TIME_T_IS_64BIT 'system tar can read our future mtime' '
406 echo 4147 >expect &&
407 tar_info future.tar | cut -d" " -f2 >actual &&
408 test_cmp expect actual
t/test-lib.sh
+1
@@ -1166,3 +1166,4 @@ test_lazy_prereq LONG_IS_64BIT '
1166 '
1167
1168 test_lazy_prereq TIME_IS_64BIT 'test-date is64bit'
1169 +test_lazy_prereq TIME_T_IS_64BIT 'test-date time_t-is64bit'