fix(git_commit): leading space in git commit tag (#2697)

* Move git_commit tag leading space into config

Fixes #2692

* Update doc default commit tag
This commit is contained in:
Jason-S-Ross 2021-05-08 12:01:00 -07:00 committed by GitHub
parent 45bb13047d
commit 3b37bcd063
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -1154,7 +1154,7 @@ The `git_commit` module shows the current commit hash and also the tag (if any)
| `style` | `"bold green"` | The style for the module. | | `style` | `"bold green"` | The style for the module. |
| `only_detached` | `true` | Only show git commit hash when in detached `HEAD` state | | `only_detached` | `true` | Only show git commit hash when in detached `HEAD` state |
| `tag_disabled` | `true` | Disables showing tag info in `git_commit` module. | | `tag_disabled` | `true` | Disables showing tag info in `git_commit` module. |
| `tag_symbol` | `"🏷 "` | Tag symbol prefixing the info shown | | `tag_symbol` | `" 🏷 "` | Tag symbol prefixing the info shown |
| `disabled` | `false` | Disables the `git_commit` module. | | `disabled` | `false` | Disables the `git_commit` module. |
### Variables ### Variables

View File

@ -23,7 +23,7 @@ impl<'a> Default for GitCommitConfig<'a> {
style: "green bold", style: "green bold",
only_detached: true, only_detached: true,
disabled: false, disabled: false,
tag_symbol: "🏷 ", tag_symbol: " 🏷 ",
tag_disabled: true, tag_disabled: true,
} }
} }

View File

@ -80,7 +80,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
_ => None, _ => None,
}) })
.map(|variable| match variable { .map(|variable| match variable {
"tag" => Some(Ok(format!(" {}{}", &config.tag_symbol, &tag_name))), "tag" => Some(Ok(format!("{}{}", &config.tag_symbol, &tag_name))),
_ => None, _ => None,
}) })
.parse(None) .parse(None)
@ -323,7 +323,7 @@ mod tests {
.config(toml::toml! { .config(toml::toml! {
[git_commit] [git_commit]
tag_disabled = false tag_disabled = false
tag_symbol = "" tag_symbol = " "
}) })
.path(&repo_dir.path()) .path(&repo_dir.path())
.collect(); .collect();
@ -395,7 +395,7 @@ mod tests {
[git_commit] [git_commit]
only_detached = false only_detached = false
tag_disabled = false tag_disabled = false
tag_symbol = "" tag_symbol = " "
}) })
.path(&repo_dir.path()) .path(&repo_dir.path())
.collect(); .collect();