]> git.ipfire.org Git - thirdparty/git.git/commit
doc: document and test `@` prefix for raw timestamps
authorLuna Schwalbe <dev@luna.gl>
Tue, 2 Jun 2026 08:17:36 +0000 (10:17 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 2 Jun 2026 09:13:12 +0000 (18:13 +0900)
commit4018dc29eea31e4273c0f1b02effe6ee852f3898
treed4f9a6138fe0b04a1a9144e299e4fae911b50f11
parent67ad42147a7acc2af6074753ebd03d904476118f
doc: document and test `@` prefix for raw timestamps

The Git internal date format `<unix-timestamp> <time-zone-offset>`
fails to parse when the timestamp is less than 100,000,000 (fewer than
9 digits). This happens to avoid potential ambiguity with other date
formats such as `YYYYMMDD`, especially when used with approxidate.

To force the parser to interpret the value as a raw timestamp, it must
be prefixed with `@` (e.g., `@0 +0000`). This behavior was introduced
in 2c733fb24c10a9d7aacc51f956bf9b7881980870 (parse_date(): '@' prefix
forces git-timestamp, 2012-02-02) but was never documented.

Document the `@` prefix in `Documentation/date-formats.adoc` to make
this behavior explicit. Also add test cases to `t/t0006-date.sh` to
verify and demonstrate the difference between prefixed and unprefixed
small timestamps (e.g., `@2000` vs `2000`).

Signed-off-by: Luna Schwalbe <dev@luna.gl>
Co-authored-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/date-formats.adoc
t/t0006-date.sh