diff --git a/tests/fixtures/make_pre_epoch_repo.sh b/tests/fixtures/make_pre_epoch_repo.sh new file mode 100644 index 000000000..8b6424fab --- /dev/null +++ b/tests/fixtures/make_pre_epoch_repo.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -eu -o pipefail + +git init -q +git checkout -b main + +echo "hello\nworld" >> code.rs +git add code.rs +GIT_AUTHOR_DATE="@0 +0000" GIT_COMMITTER_DATE="@0 +0000" git commit -q -m c1 +git cat-file -p @ > to-be-patched.txt + +patch -p1 < 0 +0000 +-committer committer 0 +0000 ++author author -5263747740 +0009 ++committer committer -5263747740 +0009 + + c1 +EOF + +new_commit=$(git hash-object -w -t commit to-be-patched.txt) +git update-ref refs/heads/main $new_commit + diff --git a/tests/repo.rs b/tests/repo.rs index 826b7c9aa..9c0a60512 100644 --- a/tests/repo.rs +++ b/tests/repo.rs @@ -83,3 +83,14 @@ fn test_partial_repo() -> Result<()> { let _info = build_info(&config).expect("no error"); Ok(()) } + +#[test] +fn test_repo_with_pre_epoch_dates() -> Result<()> { + let repo = repo("make_pre_epoch_repo.sh")?; + let config: CliOptions = CliOptions { + input: repo.path().to_path_buf(), + ..Default::default() + }; + let _info = build_info(&config).expect("no error"); + Ok(()) +}