summaryrefslogtreecommitdiffstats
path: root/git-base.sh
diff options
context:
space:
mode:
Diffstat (limited to 'git-base.sh')
-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
+}