Git.commit: CommitOptions.date only sets the author date, not the committer date
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- git, typescript
- Lĩnh vực
- tooling
Hướng nghiên cứu
Đọc src/util/git.ts và xác định cách Git.commit xử lý options.date; sau đó tìm các test hiện có liên quan đến commit và chạy chúng trước khi thêm một trường hợp hồi quy. Hoàn tất có nghĩa là một commit được cung cấp một ngày sẽ báo cáo các timestamp author và committer khớp nhau trong cả %ai và %ci.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 2
- Fork
- 1
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của joewalker/loop-the-loop
-
bug S4
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
joewalker/loop-the-loop#88 ·
-
Git exec(): child killed by a signal rejects with new Error('') and loses the signal informationĐang mởbug S3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
joewalker/loop-the-loop#84 ·
-
bug S3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
joewalker/loop-the-loop#83 ·
-
bug S4
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
joewalker/loop-the-loop#79 ·
-
bug S4
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
joewalker/loop-the-loop#78 ·
Tất cả issue của joewalker/loop-the-loop
Issue tương tự
-
ready-for-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
xavxyz/bei-shan-lin-shui#57 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] rag: sentence content can cross the reported sentence boundariesCó thể đã có người làm @LJK-ikun đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
README: the Resource URI Schemas example's file://documents/* pattern only matches that literal URIĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
platformatic/mcp#361 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
最近文档这个弹窗,左右宽度没有最小宽度限制Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
siyuan-note/siyuan#20799 · 7 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày