diff options
author | Thomas Geffert <thomas.geffert@arcutronix.com> | 2011-03-02 19:12:15 +0800 |
---|---|---|
committer | Leonid Volnitsky <leonid@volnitsky.com> | 2011-04-07 20:14:34 +0800 |
commit | 47b70d6de513aaa8f32911c92f1f3508c76c6f53 (patch) | |
tree | 3643a37a94a8c8e10de0d80c7ae2b291da6fcc0e /git-prompt.sh | |
parent | added count_only option (diff) | |
download | git-prompt-47b70d6de513aaa8f32911c92f1f3508c76c6f53.tar.gz git-prompt-47b70d6de513aaa8f32911c92f1f3508c76c6f53.tar.bz2 git-prompt-47b70d6de513aaa8f32911c92f1f3508c76c6f53.zip |
added rawhex_len option to set length of displayed git revision id
Diffstat (limited to 'git-prompt.sh')
-rwxr-xr-x | git-prompt.sh | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/git-prompt.sh b/git-prompt.sh index e4eb9f6..81bca6c 100755 --- a/git-prompt.sh +++ b/git-prompt.sh @@ -56,6 +56,7 @@ max_file_list_length=${max_file_list_length:-100} upcase_hostname=${upcase_hostname:-on} count_only=${count_only:-off} + rawhex_len=${rawhex_len:-6} aj_max=20 @@ -483,9 +484,13 @@ parse_git_status() { #### GET GIT HEX-REVISION - rawhex=`git rev-parse HEAD 2>/dev/null` - rawhex=${rawhex/HEAD/} - rawhex=${rawhex:0:6} + if [[ $rawhex_len -gt 0 ]] ; then + rawhex=`git rev-parse HEAD 2>/dev/null` + rawhex=${rawhex/HEAD/} + rawhex="$white=${rawhex:0:$rawhex_len}" + else + rawhex="" + fi #### branch branch=${branch/master/M} @@ -511,7 +516,7 @@ parse_git_status() { fi #branch="<$branch>" fi - vcs_info="$branch$white=$rawhex" + vcs_info="$branch$rawhex" fi } |