Skip to content

Conversation

@davefx
Copy link

@davefx davefx commented May 25, 2018

Through the variable DISABLE_GIT_AWARE, allow disabling the software.
This is needed, for example, when using a huge git repository, if we don't want the script to slow the command line work

Through the variable DISABLE_GIT_AWARE, allow disabling the software.
This is needed, for example, when using a huge git repository, if we don't want the script to slow the command line work
local status=$(git status --porcelain 2> /dev/null)
if [[ "$status" != "" ]]; then
git_dirty='*'
if [ x$DISABLE_GIT_AWARE = x ]; then

Choose a reason for hiding this comment

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

I would change this function to always set git_dirty='' at the beginning and then add [ -z "${DISABLE_GIT_AWARE}" ] || return to guard instead of needing to indent everything beyond it.

Copy link

@AaronDMarasco-VSI AaronDMarasco-VSI left a comment

Choose a reason for hiding this comment

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

Oops I clicked the wrong button I wanted this to be a comment.

fi
git_branch="($branch)"
else
git_branch=""

Choose a reason for hiding this comment

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

I would change this to git_branch="(git check disabled)" or something similar in case the user was wondering why it didn't work.

@AaronDMarasco-VSI
Copy link

Instead of a variable that disables all repos in your current shell, another option is to have something in your local clone that you know is problematic. A quick example showing that git is perfectly happy storing whatever you want in its config files:

$ git config ext.git-aware-prompt.disable 1
$ git config -l | grep aware
ext.git-aware-prompt.disable=1
$ grep -A1 aware ../../../.git/config 
[ext "git-aware-prompt"]
        disable = 1
$ git config --get --bool ext.git-aware-prompt.disable
true

This would change the bash script a little more, but I think it would be much more "git-like."

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.

2 participants