fish-shell icon indicating copy to clipboard operation
fish-shell copied to clipboard

Clean state icon not shown in Git prompt with informative mode enabled

Open winterqt opened this issue 3 years ago • 1 comments

To reproduce:

winter@snowball ~> mkdir r
winter@snowball ~> cd r
winter@snowball ~/r> git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: 	git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: 	git branch -m <name>
Initialized empty Git repository in /private/var/folders/t8/009s4fhn3jg9cb224djx3mrh0000gn/T/tmp.sS4Cqj1C/r/.git/
winter@snowball ~/r (master)> git config bash.showInformativeStatus true
winter@snowball ~/r (master)> echo "bar" >> foo
winter@snowball ~/r (master)> git add foo
winter@snowball ~/r (master +1)> git commit -m foo
Author identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'winter@snowball.(none)')
winter@snowball ~/r (master +1) [128]> git config --global user.email "[email protected]"
                                         git config --global user.name "Your Name"
winter@snowball ~/r (master +1)> git commit -m foo
[master (root-commit) 7b19037] foo
 1 file changed, 1 insertion(+)
 create mode 100644 foo
winter@snowball ~/r (master)>

Fish v3.5.0, Darwin snowball 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:29 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T8101 arm64, xterm-256color.

I've confirmed that this occurs in an environment with no customizations, and this did not happen in versions prior to 3.5.0.

winterqt avatar Jun 28 '22 01:06 winterqt

Ah, I see what's happening here. This specific bit is only defined by default when the actual $__fish_git_prompt_show_informative_status is used - because the other prompt style never used it.

Use set -g __fish_git_prompt_char_cleanstate '✔' to define it.

Using the git option enables the informative logic, but not the informative characters. Tbh we'd mostly envisioned it being used to disable the informative prompt because it's slow.

We could update the chars if the git option is used, but that would require us to abandon some of our caching. Probably an okay idea anyway, I don't know if it's worth a lot.

faho avatar Jun 28 '22 04:06 faho