Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add option to prevent checking git repository status when accessing repo over a slow connection. #1609

Closed
wants to merge 1 commit into from

4 participants

@coddingtonbear

Currently when one has an network share mounted, navigating into directories containing git repositories can be extremely slow.

This modification allows one to specify in one's repository configuration a single hostname in the oh-my-zsh.show-branch-on-only configuration key that ZSH will check prior to checking a repository's status. Should this configuration setting be specified, and the hostname in its value not match one's hostname, repository status will not be checked.

@coddingtonbear coddingtonbear Modify git_prompt_info to _not_ check git repository status when conf…
…iguration option is specified and does not match current hostname.
848dcba
@robertkraig

@latestrevision how do you use this?.. I'm running into the same issue with my smb/nfs share over vpn.

@coddingtonbear

Hey there @robertkraig, you can use this by setting the oh-my-zsh.show-branch-on-only setting in a cloned repository's .git/config file; you can do this by adding a section like:

[oh-my-zsh]
show-branch-on-only=the_hostname_the_git_repository_is_actually_checked_out_on

When zsh attempts to gather branch information, it will first check the repository's configuration for this key, and then compare this with the hostname of the machine on which you're running zsh; if these do not match, no branch information will be gathered or displayed.

@mcornella

This is unnecessary since there is now an oh-my-zsh.hide-status configuration which covers more use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 15, 2013
  1. @coddingtonbear

    Modify git_prompt_info to _not_ check git repository status when conf…

    coddingtonbear authored
    …iguration option is specified and does not match current hostname.
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/git.zsh
View
8 lib/git.zsh
@@ -1,8 +1,10 @@
# get the name of the branch we are on
function git_prompt_info() {
- ref=$(git symbolic-ref HEAD 2> /dev/null) || \
- ref=$(git rev-parse --short HEAD 2> /dev/null) || return
- echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
+ if [[ "$(git config --get oh-my-zsh.show-branch-on-only)" == "$(hostname)" || -z "$(git config --get oh-my-zsh.show-branch-on-only)" ]]; then
+ ref=$(git symbolic-ref HEAD 2> /dev/null) || \
+ ref=$(git rev-parse --short HEAD 2> /dev/null) || return
+ echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
+ fi
}
Something went wrong with that request. Please try again.