mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-10 06:20:18 +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],
|
&[DiffFormat::Summary],
|
||||||
)?;
|
)?;
|
||||||
let description = if commit.description().is_empty() {
|
let description = if commit.description().is_empty() {
|
||||||
settings
|
settings.default_description()
|
||||||
.config()
|
|
||||||
.get_string("ui.default-description")
|
|
||||||
.unwrap_or("".to_owned())
|
|
||||||
} else {
|
} else {
|
||||||
commit.description().to_owned()
|
commit.description().to_owned()
|
||||||
};
|
};
|
||||||
|
@ -3023,10 +3020,7 @@ fn description_template_for_cmd_split(
|
||||||
&[DiffFormat::Summary],
|
&[DiffFormat::Summary],
|
||||||
)?;
|
)?;
|
||||||
let description = if overall_commit_description.is_empty() {
|
let description = if overall_commit_description.is_empty() {
|
||||||
settings
|
settings.default_description()
|
||||||
.config()
|
|
||||||
.get_string("ui.default-description")
|
|
||||||
.unwrap_or("".to_owned())
|
|
||||||
} else {
|
} else {
|
||||||
overall_commit_description.to_owned()
|
overall_commit_description.to_owned()
|
||||||
};
|
};
|
||||||
|
|
|
@ -146,6 +146,12 @@ impl UserSettings {
|
||||||
.unwrap_or_else(|_| "push-".to_string())
|
.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 {
|
pub fn default_revset(&self) -> String {
|
||||||
self.config.get_string("revsets.log").unwrap_or_else(|_| {
|
self.config.get_string("revsets.log").unwrap_or_else(|_| {
|
||||||
// For compatibility with old config files (<0.8.0)
|
// For compatibility with old config files (<0.8.0)
|
||||||
|
|
Loading…
Reference in a new issue