Use git_message_prettify (#924)

This commit is contained in:
R0nd 2021-10-01 00:20:43 +03:00 committed by GitHub
parent 5f34e9cc07
commit 48f9331b0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 15 deletions

View file

@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Fixed
- appropriate error message when pulling deleted remote branch ([#911](https://github.com/extrawurst/gitui/issues/991))
- improved color contrast in branches popup for light themes [[@Cottser](https://github.com/Cottser)] ([#922](https://github.com/extrawurst/gitui/issues/922))
- use git_message_prettify for commit messages ([#917](https://github.com/extrawurst/gitui/issues/917))
## [0.17.1] - 2021-09-10

View file

@ -57,6 +57,7 @@ pub use crate::{
},
tags::AsyncTags,
};
pub use git2::message_prettify;
use std::{
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},

View file

@ -11,7 +11,7 @@ use crate::{
};
use anyhow::Result;
use asyncgit::{
cached,
cached, message_prettify,
sync::{
self, get_config_string, CommitId, HookResult, RepoState,
},
@ -149,19 +149,7 @@ impl CommitComponent {
drop(file);
std::fs::remove_file(&file_path)?;
let message: String = message
.lines()
.flat_map(|l| {
if l.starts_with('#') {
vec![]
} else {
vec![l, "\n"]
}
})
.collect();
let message = message.trim().to_string();
message = message_prettify(message, Some(b'#'))?;
self.input.set_text(message);
self.input.show()?;
@ -193,7 +181,7 @@ impl CommitComponent {
)));
return Ok(());
}
let mut msg = msg;
let mut msg = message_prettify(msg, Some(b'#'))?;
if let HookResult::NotOk(e) =
sync::hooks_commit_msg(CWD, &mut msg)?
{