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

Disable prompt_git for oh-my-zsh.hide-status #4562

Closed

Conversation

MikaelSmith
Copy link

Fixes issue #4561

@@ -85,6 +85,9 @@ prompt_context() {

# Git: branch/detached head, dirty status
prompt_git() {
if [[ "$(git config --get oh-my-zsh.hide-status 2>/dev/null)" == "1" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest this:

  if ! git config --get oh-my-zsh.hide-status &> /dev/null; then
    return
  fi

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that accomplishes the same thing. That's just testing whether the configuration setting is present, and treats its set values as equivalent.

Starting off in a repo where it's not set at all:

[~/.oh-my-zsh on ⇄ master]
$ if ! git config --get oh-my-zsh.hide-status; then echo yep; fi
yep
[~/.oh-my-zsh on ⇄ master]
$ git config oh-my-zsh.hide-status 0
[~/.oh-my-zsh on ⇄ master]
$ if ! git config --get oh-my-zsh.hide-status; then echo yep; fi
0
[~/.oh-my-zsh on ⇄ master]
$ git config oh-my-zsh.hide-status 1
[~/.oh-my-zsh]
$ if ! git config --get oh-my-zsh.hide-status; then echo yep; fi
1
[~/.oh-my-zsh]
$

If you use that test, then it will take the early return for any repo where that config setting is not defined, and it will ignore its value and proceed for any repo where it is defined.

@drasill
Copy link

drasill commented Nov 20, 2015

Tested it, LGTM.

@MikaelSmith
Copy link
Author

Updated with a suggestion from the issue.

@troglotit
Copy link

I've tested it, works for me. +1 on merging

@MikaelSmith
Copy link
Author

This seems to have been moved out of themes somewhere. Closing it as no longer relevant.

@MikaelSmith MikaelSmith closed this Apr 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants