Trim commits when reading from Git refs (#7922)

## Summary

Closes #7919.
This commit is contained in:
Charlie Marsh 2024-10-04 12:10:53 +01:00 committed by GitHub
parent b23feebb6d
commit d80139698d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -45,7 +45,8 @@ impl CacheCommit {
})?;
let commit = if let Some(git_ref) = git_ref_parts.next() {
let git_ref_path = git_dir.join(git_ref);
fs_err::read_to_string(git_ref_path)?
let commit = fs_err::read_to_string(git_ref_path)?;
commit.trim().to_string()
} else {
commit_or_ref.to_string()
};