diff options
author | Hugues Hiegel <hugues.hiegel@qosmos.com> | 2013-08-07 18:08:37 +0200 |
---|---|---|
committer | Hugues Hiegel <hugues.hiegel@qosmos.com> | 2013-08-07 18:08:37 +0200 |
commit | 8d1e13ef355c3bfef2c73e1a69a7c1f93bf85d46 (patch) | |
tree | f11609c5a0368880e085635cbdad1e3d6a44f856 | |
parent | c4478f36bb64761ddf76c4a7cbc5f095c18285de (diff) |
[Git] Uses a commit-ish variable
-rw-r--r-- | 01_Internal.zsh | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/01_Internal.zsh b/01_Internal.zsh index bf56b33..66dcbb3 100644 --- a/01_Internal.zsh +++ b/01_Internal.zsh @@ -154,7 +154,7 @@ __get_git_fullstatus () __get_git_branch () { - local my_git_branch checkouted_branch + local my_git_branch checkouted_branch commit_ish __debug __debug -n " repo..." @@ -176,6 +176,9 @@ __get_git_branch () \( ! -d .git -o -z "$GIT_DIR" \) -a \ "$(git rev-parse --is-inside-git-dir 2>&-)" != "true" ] && return + # commit-ish, for future uses + commit_ish=$(git rev-parse --verify HEAD 2>/dev/null) + # Get current working GIT branch my_git_branch="$(git branch 2>&- | grep -E '^\* ' | cut -c3-)" # for future use @@ -191,7 +194,7 @@ __get_git_branch () # If neither on a named commit-ish, show commit-id if [ "$my_git_branch" = "undefined" ] then - my_git_branch="$(git rev-parse --verify HEAD 2>&- | cut -c-7)…" + my_git_branch="$(echo $commit_ish | cut -c-7)" fi else # Initial commit |