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

agnoster: better respect hide-dirty git config by plainly coloring prompt and not running checks for changes #8930

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

eliblock
Copy link

@eliblock eliblock commented May 15, 2020

Standards checklist:

  • The PR title is descriptive.
  • The PR doesn't replicate another PR which is already open.
  • I have read the contribution guide and followed all the instructions.
  • The code follows the code style guide detailed in the wiki.
  • The code is mine or it's from somewhere with an MIT-compatible license.
  • The code is efficient, to the best of my ability, and does not waste computer resources.
  • The code is stable and I have tested it myself, to the best of my abilities.

Changes:

  • In the git prompt: do not re-check entire working tree for changes if parse_get_dirty indicates a clean working tree. This will avoid re-processing clean working trees, and ensure that we respect oh-my-zsh.hide-dirty to avoid slow loading on large repos.
  • In the git prompt: color the prompt segment white if oh-my-zsh.hide-dirty is set. Previously the prompt would be colored green (indicating a clean tree) whenever this flag is set, even if the tree is dirty. This new color indicates the lack of status, rather than misleadingly indicating a clean tree.

Other comments:

$dirty will be empty if parse_git_dirty returns a clean result - which
may happen because the working directory is clean or because a
configuration has been set (e.g., oh-my-zsh.hide-dirty) which disables
the check. In either event, we should respect the former check and avoid
querying for a dirty working directory a second time.
If hide-dirty is set, parse_git_dirty will not check the directory's
status. Rather than coloring the git-status portion of the prompt green
(which typically indicates a clean working directory) we color this
portion of the prompt white to reflect the lack of information.
@ohmyzsh ohmyzsh bot added the Area: theme Issue or PR related to a theme label May 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: theme Issue or PR related to a theme
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

None yet

2 participants