Skip to content

Commit

Permalink
Merge pull request #1496 from EliahKagan/touch
Browse files Browse the repository at this point in the history
Have `touch` in test fixture fall back to portable format
  • Loading branch information
Byron authored Aug 8, 2024
2 parents 96d3470 + bbbd1eb commit 9b72c61
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions gix-index/tests/fixtures/file_metadata.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/env bash
set -eu -o pipefail

# The largest-possible date for Ext4, nanos are special there, but ont usually on other filesystems
touch -d "2446-05-10 22:38:55.111111111" future
# The smallest-possible date for Ext4, nanos are special there, but ont usually on other filesystems
touch -d "1901-12-13 20:45:52.222222222" past
# Attempt to create files with the latest and earliest possible dates for ext4. Nanoseconds are
# special there, but not usually on other filesystems. In some touch implementations, the format
# may be rejected. So if a command fails, we try again with a more extreme date that is out of
# range, because some implementations will clip it to the edge of the range (but they may fail).
touch -d '2446-05-10 22:38:55.111111111' future || touch -d '2446-05-11 22:38:56' future
touch -d '1901-12-13 20:45:52.222222222' past || touch -d '1901-12-13 20:45:52' past

0 comments on commit 9b72c61

Please sign in to comment.