Skip to content

Commit 6b9c38e

Browse files
peffgitster
authored andcommitted
t0006: skip "far in the future" test when unsigned long is not long enough
Git's source code refers to timestamps as unsigned longs. On 32-bit platforms, as well as on Windows, unsigned long is not large enough to capture dates that are "absurdly far in the future". While we can fix this issue properly by replacing unsigned long with a larger type, we want to be a bit more conservative and just skip those tests on the maint track. Signed-off-by: Jeff King <[email protected]> Helped-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bab7483 commit 6b9c38e

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

help.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,12 @@ int cmd_version(int argc, const char **argv, const char *prefix)
419419
* with external projects that rely on the output of "git version".
420420
*/
421421
printf("git version %s\n", git_version_string);
422+
while (*++argv) {
423+
if (!strcmp(*argv, "--build-options")) {
424+
printf("sizeof-long: %d\n", (int)sizeof(long));
425+
/* NEEDSWORK: also save and output GIT-BUILD_OPTIONS? */
426+
}
427+
}
422428
return 0;
423429
}
424430

t/t0006-date.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ check_show () {
3131
format=$1
3232
time=$2
3333
expect=$3
34-
test_expect_${4:-success} "show date ($format:$time)" '
34+
test_expect_success $4 "show date ($format:$time)" '
3535
echo "$time -> $expect" >expect &&
3636
test-date show:$format "$time" >actual &&
3737
test_cmp expect actual
@@ -50,8 +50,8 @@ check_show iso-local "$TIME" '2016-06-15 14:13:20 +0000'
5050

5151
# arbitrary time absurdly far in the future
5252
FUTURE="5758122296 -0400"
53-
check_show iso "$FUTURE" "2152-06-19 18:24:56 -0400"
54-
check_show iso-local "$FUTURE" "2152-06-19 22:24:56 +0000"
53+
check_show iso "$FUTURE" "2152-06-19 18:24:56 -0400" LONG_IS_64BIT
54+
check_show iso-local "$FUTURE" "2152-06-19 22:24:56 +0000" LONG_IS_64BIT
5555

5656
check_parse() {
5757
echo "$1 -> $2" >expect

t/test-lib.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,3 +1098,12 @@ run_with_limited_cmdline () {
10981098
}
10991099

11001100
test_lazy_prereq CMDLINE_LIMIT 'run_with_limited_cmdline true'
1101+
1102+
build_option () {
1103+
git version --build-options |
1104+
sed -ne "s/^$1: //p"
1105+
}
1106+
1107+
test_lazy_prereq LONG_IS_64BIT '
1108+
test 8 -le "$(build_option sizeof-long)"
1109+
'

0 commit comments

Comments
 (0)