summaryrefslogtreecommitdiffstats
path: root/git-base.sh
diff options
context:
space:
mode:
authorMichael Allen <michael@michaelallen.io>2015-02-17 17:09:45 +0000
committerMichael Allen <michael@michaelallen.io>2015-02-17 17:09:45 +0000
commitf05711dbcf196f98f0e08d783f760d47d98b93a6 (patch)
tree9906f0cf7d540d35fc1d46fd5d3396d3d50c8207 /git-base.sh
parent19d104ac60b19c1a11a72f4ebbb63e933552fcf0 (diff)
downloadgit-sonar-f05711dbcf196f98f0e08d783f760d47d98b93a6.tar.gz
git-sonar-f05711dbcf196f98f0e08d783f760d47d98b93a6.zip
untracked files reporting
Diffstat (limited to '')
-rwxr-xr-xgit-base.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/git-base.sh b/git-base.sh
index d2262d4..d9dc10a 100755
--- a/git-base.sh
+++ b/git-base.sh
@@ -176,3 +176,15 @@ remote_ahead_of_master() {
echo "0"
fi
}
+
+porcelain_status() {
+ echo "$(git status --porcelain 2>/dev/null)"
+}
+
+untracked_files() {
+ if is_repo; then
+ git_status="$(porcelain_status)"
+ untracked="$(echo "$git_status" | grep -p "?? " | wc -l | grep -oEi '[0-9][0-9]*')"
+ echo "$untracked"
+ fi
+}