fix git::git_log_oldest_timestamp() when there are multiple log entries

This commit is contained in:
Sebastian Kuzminsky 2025-07-08 14:45:17 -06:00
parent be362517fb
commit a2c7ce34a3

View file

@ -191,6 +191,7 @@ pub fn git_log_oldest_timestamp(
.args([ .args([
"log", "log",
"--pretty=format:%at", "--pretty=format:%at",
"--",
&path.file_name().unwrap().to_string_lossy(), &path.file_name().unwrap().to_string_lossy(),
]) ])
.current_dir(&git_dir) .current_dir(&git_dir)
@ -201,7 +202,8 @@ pub fn git_log_oldest_timestamp(
return Err(GitError::Oops); return Err(GitError::Oops);
} }
let timestamp_str = std::str::from_utf8(&result.stdout).unwrap(); let timestamp_str = std::str::from_utf8(&result.stdout).unwrap();
let timestamp_i64 = timestamp_str.parse::<i64>()?; let timestamp_last = timestamp_str.split("\n").last().unwrap();
let timestamp_i64 = timestamp_last.parse::<i64>()?;
let timestamp = chrono::DateTime::from_timestamp(timestamp_i64, 0) let timestamp = chrono::DateTime::from_timestamp(timestamp_i64, 0)
.unwrap() .unwrap()
.with_timezone(&chrono::Local); .with_timezone(&chrono::Local);