From a126690cb0bace4d00ee967fa508d1babed9da64 Mon Sep 17 00:00:00 2001 From: Arialdo Martini Date: Wed, 28 May 2014 09:05:03 +0200 Subject: [PATCH] fix #25 - oh-my-git can be disabled on a per-repository basis (idea by Olaf Alders) --- README.md | 9 +++++++++ base.sh | 6 ++++++ prompt.sh | 1 + 3 files changed, 16 insertions(+) diff --git a/README.md b/README.md index 7595171..ff575b2 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,15 @@ which are optional, but very cool. Then, restart zsh. antigen will download and install all that's needed. +# Disabling oh-my-git +oh-my-git can be disabled on a per-repository basis. Just add a + + [oh-my-git] + enabled = true + +in the `.git/config` file of a repo to revert to the original prompt for that particular repo. This could be handy when working with very huge repository, when the git commands invoked by oh-my-git can slow down the prompt. + + # Known bugs and limitations * git v1.8.4 or newer is required diff --git a/base.sh b/base.sh index 1c63fe4..2d14247 100644 --- a/base.sh +++ b/base.sh @@ -12,6 +12,12 @@ function enrich { } function build_prompt { + enabled=`git config --local --get oh-my-git.enabled` + if [[ ${enabled} == false ]]; then + echo "${PSORG}" + exit; + fi + PS1="" # Git info current_commit_hash=$(git rev-parse HEAD 2> /dev/null) diff --git a/prompt.sh b/prompt.sh index 748b04a..5547a5e 100644 --- a/prompt.sh +++ b/prompt.sh @@ -1,3 +1,4 @@ +PSORG=$PS1; if [ -n "${BASH_VERSION}" ]; then DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"