fix(gix-date): reject ambiguous bare numeric dates - #3002
Merged
Merged
Conversation
<!-- agent -->
`parse("20080214", None)` silently returned epoch seconds in 1970 because
any signed integer was accepted before the flexible date parser. Apply
Git's `100000000` floor to bare timestamps so compact-date lookalikes,
zero, and negative numbers do not silently become epoch seconds. Explicit
`@` timestamps and raw commit-header dates retain their existing behavior.
Update the documented examples and their existing acceptance tests.
Extend the existing Git baseline with six rejected bare numbers and three
explicit raw timestamps. Generate fixed-date samples through
`GIT_AUTHOR_DATE` and `git var GIT_AUTHOR_IDENT`: the previous expiry-date
parser could fall back to approximate dates and conceal these errors.
The regenerated archive preserves all 128 existing baseline samples.
The regression failed on `20080214` before the parser change.
Git reference: `date.c::match_digit()` reserves numbers below `100000000`
for date components; `t/t0006-date.sh` covers the threshold and explicit
`@0 +0000`. Baselines were generated with Git 2.50.1 (Apple Git-155).
Assisted-by: GPT 6.0
Co-authored-by: GPT 6.0 <codex@openai.com>
Sebastian Thiel (Byron)
force-pushed
the
fix-8bit-date
branch
from
September 16, 2026 09:47
5ea084a to
7c90c2b
Compare
Sebastian Thiel (Byron)
marked this pull request as ready for review
September 16, 2026 09:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tasks
This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.
Everything below this line was generated by
Codex GPT-6.Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Fixes #3001.
gix_date::parse("20080214", None)now returns an error. Bare numeric timestamps must be at least100000000, matching Git's threshold; explicit forms such as@0,@-1000, and@20080214remain supported. The API documentation and existing example tests reflect this behavior.The regression extends the existing Git baseline with six rejected bare numbers and three accepted explicit timestamps. Fixed-date samples now use
GIT_AUTHOR_DATEwithgit var GIT_AUTHOR_IDENT, avoiding the expiry parser's approximate-date fallback. The regenerated archive preserves all 128 existing samples. Git reference:date.c::match_digit()and the threshold cases int/t0006-date.sh; generated with Git 2.50.1 (Apple Git-155).Validation:
20080214before the fix.GIX_TEST_IGNORE_ARCHIVES=1 cargo test -p gix-date -p gix-revision --features serde --quiet— 174 tests and the doctest pass.GIX_TEST_IGNORE_ARCHIVES=1 cargo +nightly test -p gix-date --all-features --doc --quiet— passes.cargo clippy -p gix-date --all-targets --all-features -- -D warnings -A unknown-lints --no-deps— passes.cargo fmt --all -- --checkand fixture shell syntax validation — pass.codex review --commit 5ea084aa50342a7bfe2fc1669744d35f026a45df— no findings.