Observed behavior
Git.commit in src/util/git.ts forwards options.date as --date=<iso> to git:
if (date != null) {
args.push(`--date=${new Date(date).toISOString()}`);
}
Git's --date flag only sets the AUTHOR date. The committer date defaults to "now" unless GIT_COMMITTER_DATE is set. Because the API exposes a single date, callers will reasonably assume it sets the commit's timestamp, but only one of the two timestamps actually changes.
Expected behavior
A single date option should set both author and committer dates so the resulting commit is fully deterministic, or the option should be renamed/split to make the asymmetry explicit.
Minimal reproduction
const date = new Date('1970-01-01T00:00:00Z').getTime();
await git.commit('msg', {
committer: { name: 'X', email: 'x@y' },
date,
});
// git log -1 --format='AD=%ai CD=%ci'
// -> AD=1970-01-01 00:00:00 +0000 CD=2026-05-25 19:25:44 +0100
Verified with a standalone Node script that replicates the exact spawn arguments used by Git.commit.
Suggested fix
Set both timestamps via environment variables, which avoids relying on the asymmetric --date flag:
if (date != null) {
const iso = new Date(date).toISOString();
env['GIT_AUTHOR_DATE'] = iso;
env['GIT_COMMITTER_DATE'] = iso;
}
Add a regression test that commits with a date and asserts both %ai and %ci match.
Observed behavior
Git.commitinsrc/util/git.tsforwardsoptions.dateas--date=<iso>to git:Git's
--dateflag only sets the AUTHOR date. The committer date defaults to "now" unlessGIT_COMMITTER_DATEis set. Because the API exposes a singledate, callers will reasonably assume it sets the commit's timestamp, but only one of the two timestamps actually changes.Expected behavior
A single
dateoption should set both author and committer dates so the resulting commit is fully deterministic, or the option should be renamed/split to make the asymmetry explicit.Minimal reproduction
Verified with a standalone Node script that replicates the exact spawn arguments used by
Git.commit.Suggested fix
Set both timestamps via environment variables, which avoids relying on the asymmetric
--dateflag:Add a regression test that commits with a date and asserts both
%aiand%cimatch.