Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Git.commit: CommitOptions.date only sets the author date, not the committer date

オープン 初心者向け
#82 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
git, typescript
領域
tooling

調査の方向性

src/util/git.ts を読み、Git.commit における options.date の処理箇所を特定する。次に、既存の commit 関連テストを見つけ、回帰ケースを追加する前に実行する。完了条件は、1つの日付を指定した commit が、%ai と %ci の両方で一致する author と committer のタイムスタンプを報告すること。

索引モデルが issue の本文から書いたものです。

説明

bug S3

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.

主要言語
TypeScript
スター
2
フォーク
1
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

joewalker/loop-the-loop のほかの issue

joewalker/loop-the-loop の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。