forked from mirrors/jj
git_backend: use lossy conversion to decode non-UTF-8 commit message
If message() returned None, it doesn't mean the commit message is empty. I originally mapped it to an error, but that made import of linux repo fail. https://docs.rs/git2/latest/git2/struct.Commit.html#method.message
This commit is contained in:
parent
06c254e742
commit
847adc832f
1 changed files with 3 additions and 1 deletions
|
@ -316,7 +316,9 @@ fn commit_from_git_without_root_parent(
|
|||
} else {
|
||||
MergedTreeId::Legacy(tree_id)
|
||||
};
|
||||
let description = commit.message().unwrap_or("<no message>").to_owned();
|
||||
// Use lossy conversion as commit message with "mojibake" is still better than
|
||||
// nothing.
|
||||
let description = String::from_utf8_lossy(commit.message_bytes()).into_owned();
|
||||
let author = signature_from_git(commit.author());
|
||||
let committer = signature_from_git(commit.committer());
|
||||
|
||||
|
|
Loading…
Reference in a new issue