Skip to content

Commit c76d793

Browse files
eugenerCopilot
andauthored
Fix src/commands/tag.rs
The DateTime::from_timestamp(0, 0).unwrap_or_else(Utc::now) chain is problematic. If DateTime::from_timestamp(0, 0) fails (which is extremely unlikely), it falls back to the current time, making it inconsistent with the documented behavior of using Unix epoch as a fallback for data corruption. Consider using DateTime::from_timestamp(0, 0).unwrap() or a more explicit error handling approach. Co-authored-by: Copilot <[email protected]>
1 parent ff3fc89 commit c76d793

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/commands/tag.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ fn parse_for_each_ref_line(line: &str) -> Result<Tag> {
427427
let timestamp = parse_unix_timestamp(tagger_date).unwrap_or_else(|_| {
428428
// Timestamp parsing failed - this indicates malformed git metadata
429429
// Use Unix epoch (1970-01-01) as fallback to make data corruption obvious
430-
DateTime::from_timestamp(0, 0).unwrap_or_else(Utc::now)
430+
DateTime::from_timestamp(0, 0).unwrap()
431431
});
432432
Some(Author {
433433
name: tagger_name.to_string(),

0 commit comments

Comments
 (0)