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 | |
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
-rw-r--r-- | git-prompt.conf | 1 | ||||
-rwxr-xr-x | git-prompt.sh | 13 |
2 files changed, 10 insertions, 4 deletions
diff --git a/git-prompt.conf b/git-prompt.conf index 414c3d6..c136964 100644 --- a/git-prompt.conf +++ b/git-prompt.conf @@ -11,6 +11,7 @@ # error_bell=off # sound terminal bell when command return code is not zero. (use setterm to set pitch and duration) # max_file_list_length=100 # in characters # count_only=off # off - display file list; on - display file count +# rawhex_len=6 # length of git rawhex revision id display (use 0 to hide it) ############################################################ MODULES 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 } |