I think there's a bug at src/index.rs:61-62:
ctime: git2::IndexTime::new(value.ctime.second() as i32, value.ctime.nanosecond()),
mtime: git2::IndexTime::new(value.mtime.second() as i32, value.mtime.nanosecond()),
chrono::Timelike::second() returns the seconds-of-minute (0–59), but git2::IndexTime::new takes a Unix timestamp here — the forward direction on lines 35–37 reads it back via git2::IndexTime::seconds() (plural). So a round-tripped ctime/mtime ends up in the first minute of 1970-01-01 UTC.
No public API currently triggers this path, so nothing breaks today. It would only matter once something wraps git2::Index::add(&IndexEntry) or similar.
Happy to send a PR.
I think there's a bug at
src/index.rs:61-62:chrono::Timelike::second()returns the seconds-of-minute (0–59), butgit2::IndexTime::newtakes a Unix timestamp here — the forward direction on lines 35–37 reads it back viagit2::IndexTime::seconds()(plural). So a round-trippedctime/mtimeends up in the first minute of 1970-01-01 UTC.No public API currently triggers this path, so nothing breaks today. It would only matter once something wraps
git2::Index::add(&IndexEntry)or similar.Happy to send a PR.