Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git_prompt: Only show untracked files in informative mode if asked #8980

Merged
merged 1 commit into from
Jun 7, 2022

Conversation

faho
Copy link
Member

@faho faho commented May 30, 2022

This makes it so

  1. The informative status can work without showing untracked
    files (previously it was disabled if bash.showUntrackedFiles was
    false)
  2. If untrackedfiles isn't explicitly enabled, we use -uno, so git
    doesn't have to scan all the files.

In a large repository (like the FreeBSD ports repo), this can improve
performance by a factor of 5 or up.


The impetus for this is that our informative+vcs prompt already tries to disable untracked file display via the (undocumented) __fish_git_prompt_hide_untrackedfiles variable, so in that case we're just wasting time.

We could also make it so we recognize that option and skip untracked display (or make it use $__fish_git_prompt_status_order without untrackedfiles), but:

  1. We've decided that it's not useful there, so we apparently don't like it in the prompt meant to showcase the informative git prompt!
  2. This can be very costly and so should probably be enabled explicitly.

Part of #8979 (well, except for the terlar bit)

(we probably also want to make it so you can set $__fish_git_prompt_showuntrackedfiles to 0 to explicitly disable it)

TODOs:

  • Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.rst

This makes it so

1. The informative status can work without showing untracked
files (previously it was disabled if bash.showUntrackedFiles was
false)
2. If untrackedfiles isn't explicitly enabled, we use -uno, so git
doesn't have to scan all the files.

In a large repository (like the FreeBSD ports repo), this can improve
performance by a factor of 5 or up.
@faho faho added this to the fish 3.5.0 milestone May 30, 2022
@faho
Copy link
Member Author

faho commented May 30, 2022

the (undocumented) __fish_git_prompt_hide_untrackedfiles variable

Here's my plan for the future:

  1. Document $__fish_git_prompt_status_order
  2. Read the git prompt boolean variables as 0/1 toggles instead of checking if they are set or not, so you can disable them
  3. Remove __fish_git_prompt_hide_X, as it's now superfluous (and was only ever used with informative status)
  4. (possibly rename the variables to without the dunderscore - $fish_git_prompt_show_untrackedfiles etc)

@faho faho merged commit f9a170e into fish-shell:master Jun 7, 2022
@faho faho deleted the informative-no-untracked branch June 13, 2022 09:11
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant