Skip to content

Commit dde2914

Browse files
unhappychoiceclaude
andcommitted
fix: return error instead of fallback for invalid commit timestamp
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent c643eea commit dde2914

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎src/git.rs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,23 +145,23 @@ fn matches_date_filter(
145145
commit: &Git2Commit,
146146
before: Option<&DateTime<Utc>>,
147147
after: Option<&DateTime<Utc>>,
148-
) -> bool {
148+
) -> Result<bool> {
149149
let timestamp = commit.author().when().seconds();
150-
let commit_date = DateTime::from_timestamp(timestamp, 0).unwrap_or_else(Utc::now);
150+
let commit_date = DateTime::from_timestamp(timestamp, 0).context("Invalid commit timestamp")?;
151151

152152
if let Some(before_date) = before {
153153
if commit_date > *before_date {
154-
return false;
154+
return Ok(false);
155155
}
156156
}
157157

158158
if let Some(after_date) = after {
159159
if commit_date < *after_date {
160-
return false;
160+
return Ok(false);
161161
}
162162
}
163163

164-
true
164+
Ok(true)
165165
}
166166

167167
pub struct GitRepository {
@@ -481,7 +481,7 @@ impl GitRepository {
481481
&commit,
482482
self.before_filter.as_ref(),
483483
self.after_filter.as_ref(),
484-
) {
484+
)? {
485485
continue;
486486
}
487487
commits.push(oid);

0 commit comments

Comments
 (0)