summaryrefslogtreecommitdiffstats
path: root/git-base.sh
diff options
context:
space:
mode:
authorMichael Allen <michael@michaelallen.io>2015-03-10 16:30:10 +0000
committerMichael Allen <michael@michaelallen.io>2015-03-10 16:30:10 +0000
commit3b90ab4e2d06c3fb1383c1aff34360e510d7a856 (patch)
treebede4cb196f41953c2578edf4595b53a646a64fa /git-base.sh
parentab16bac1dbe8c3c21049b52c5002930f6bde666e (diff)
downloadgit-sonar-3b90ab4e2d06c3fb1383c1aff34360e510d7a856.tar.gz
git-sonar-3b90ab4e2d06c3fb1383c1aff34360e510d7a856.zip
clean code and silence git calls
Diffstat (limited to '')
-rwxr-xr-xgit-base.sh21
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() {