From 4d5126731aa1cb429a78f9d37ad3c8096fcfe25a Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Thu, 20 Oct 2011 19:30:55 +0800 Subject: [PATCH] Added missing parse_git_branch function --- lib/git/repo_index.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/git/repo_index.sh b/lib/git/repo_index.sh index a599857..b915275 100644 --- a/lib/git/repo_index.sh +++ b/lib/git/repo_index.sh @@ -149,6 +149,11 @@ function _git_index_count() { echo $(sed -e "s/--.*//" "$GIT_REPO_DIR/.git_index" | grep . | wc -l) } +# Returns the current git branch (returns nothing if not a git repository) +parse_git_branch() { + git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' +} + # If the working directory is clean, update the git repository. Otherwise, show changes. function _git_index_pull_or_status() { if ! [ `git status --porcelain | wc -l` -eq 0 ]; then