History

Have `touch` in test fixture fall back to portable format

For each edge-of-range `touch`, if at first it fails, try it rounded to the nearest *more extreme* value in seconds, which some implementations will accept and clip it at or near the most extreme value in the range that it was going for. See #1491.

Eliah Kagan committed 2 years ago

Commit bbbd1eb1 parent 29898e31 file · +6 −4Browse files

Unified · Split

gix-index/tests/fixtures/file_metadata.sh+6−4
@@ -1,7 +1,9 @@
1#!/usr/bin/env bash1#!/usr/bin/env bash
2set -eu -o pipefail2set -eu -o pipefail
3 3
4# The largest-possible date for Ext4, nanos are special there, but ont usually on other filesystems4# Attempt to create files with the latest and earliest possible dates for ext4. Nanoseconds are
5touch -d "2446-05-10 22:38:55.111111111" future5# special there, but not usually on other filesystems. In some touch implementations, the format
6# The smallest-possible date for Ext4, nanos are special there, but ont usually on other filesystems6# may be rejected. So if a command fails, we try again with a more extreme date that is out of
7touch -d "1901-12-13 20:45:52.222222222" past7# range, because some implementations will clip it to the edge of the range (but they may fail).
8touch -d '2446-05-10 22:38:55.111111111' future || touch -d '2446-05-11 22:38:56' future
9touch -d '1901-12-13 20:45:52.222222222' past || touch -d '1901-12-13 20:45:52' past