diff options
author | Michael Allen <michael@michaelallen.io> | 2015-03-10 16:30:10 +0000 |
---|---|---|
committer | Michael Allen <michael@michaelallen.io> | 2015-03-10 16:30:10 +0000 |
commit | 3b90ab4e2d06c3fb1383c1aff34360e510d7a856 (patch) | |
tree | bede4cb196f41953c2578edf4595b53a646a64fa /git-base.sh | |
parent | ab16bac1dbe8c3c21049b52c5002930f6bde666e (diff) | |
download | git-sonar-3b90ab4e2d06c3fb1383c1aff34360e510d7a856.tar.gz git-sonar-3b90ab4e2d06c3fb1383c1aff34360e510d7a856.zip |
clean code and silence git calls
Diffstat (limited to 'git-base.sh')
-rwxr-xr-x | git-base.sh | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/git-base.sh b/git-base.sh index b08c820..a918a24 100755 --- a/git-base.sh +++ b/git-base.sh @@ -206,19 +206,19 @@ conflicted="%{$fg_bold[yellow]%}" untracked="%{$fg_bold[white]%}" is_dirty() { - if ! git rev-parse; then + if ! git rev-parse 2>&1/dev/null; then #not in repo, thus not dirty return 1 else #in repo, might be dirty - if [[ -n "$(git ls-files --exclude-standard --others)" ]]; then + if [[ -n "$(git ls-files --exclude-standard --others 2>/dev/null)" ]]; then #untracked files thus dirty return 0 else #no untracked files - if git show HEAD --; then + if git show HEAD -- 2>&1/dev/null; then #has a commit hash, thus not on an initial commit - if ! git diff --quiet --ignore-submodules HEAD --; then + if ! git diff --quiet --ignore-submodules HEAD -- 2>&1/dev/null; then #has differences thus dirty return 0 else @@ -236,19 +236,6 @@ is_dirty() { fi fi fi - { - #returns 1 if not a git repo - git rev-parse && { - #returns 1 if untracked files - git ls-files --exclude-standard --others && ! { - git show HEAD -- || - #returns 1 if unstaged or staged files - git diff --quiet --ignore-submodules HEAD -- - } - } - } - exitCode="$?" - return "$exitCode" } porcelain_status() { |