mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-04 18:56:49 +00:00
cli: refactor default_description to UserSettings
This commit is contained in:
parent
72d6e20a08
commit
3869b7c2ac
2 changed files with 8 additions and 8 deletions
|
@ -2989,10 +2989,7 @@ fn description_template_for_commit(
|
|||
&[DiffFormat::Summary],
|
||||
)?;
|
||||
let description = if commit.description().is_empty() {
|
||||
settings
|
||||
.config()
|
||||
.get_string("ui.default-description")
|
||||
.unwrap_or("".to_owned())
|
||||
settings.default_description()
|
||||
} else {
|
||||
commit.description().to_owned()
|
||||
};
|
||||
|
@ -3023,10 +3020,7 @@ fn description_template_for_cmd_split(
|
|||
&[DiffFormat::Summary],
|
||||
)?;
|
||||
let description = if overall_commit_description.is_empty() {
|
||||
settings
|
||||
.config()
|
||||
.get_string("ui.default-description")
|
||||
.unwrap_or("".to_owned())
|
||||
settings.default_description()
|
||||
} else {
|
||||
overall_commit_description.to_owned()
|
||||
};
|
||||
|
|
|
@ -146,6 +146,12 @@ impl UserSettings {
|
|||
.unwrap_or_else(|_| "push-".to_string())
|
||||
}
|
||||
|
||||
pub fn default_description(&self) -> String {
|
||||
self.config()
|
||||
.get_string("ui.default-description")
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
pub fn default_revset(&self) -> String {
|
||||
self.config.get_string("revsets.log").unwrap_or_else(|_| {
|
||||
// For compatibility with old config files (<0.8.0)
|
||||
|
|
Loading…
Reference in a new issue