<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,4 @@
 GIT Prompt for BASH
 
-Screenshots and docs at: http://volnitsky.com/project/git-prompt
+Screenshots and docs are at: http://volnitsky.com/project/git-prompt
 </diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -8,8 +8,8 @@
 
 ###########################################################
 
-# 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
+# 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
 
 
 ############################################################   MODULES
@@ -23,14 +23,14 @@
 ###########################################################   DEFAULT OBJECTS
 ###  Default objects are not displayed.  Example:
 
-## default_user=lvv 		
-## default_host=&quot;ahp&quot;     		# remote host is always shown
-## default_domain=&quot;lvvnet&quot;	
+## default_user=lvv             
+## default_host=&quot;ahp&quot;                   # remote host is always shown
+## default_domain=&quot;lvvnet&quot;      
 
 ###########################################################   CWD
-## cwd_cmd='\w'			# display full path
-## cwd_cmd='\W'			# display only last dir of path
-cwd_cmd='cwd_truncate 40'	# display last 30 chars of path
+## cwd_cmd='\w'                 # display full path
+## cwd_cmd='\W'                 # display only last dir of path
+cwd_cmd='cwd_truncate 40'       # display last 30 chars of path
 
 ###########################################################   ETC
 
@@ -40,13 +40,13 @@ cwd_cmd='cwd_truncate 40'	# display last 30 chars of path
 
 ###  directory, exit code, root color 
 
-# if [ 0`tput colors` -ge 8 ];  then		#  if terminal supports colors
-	#	dir_color=CYAN
-	#	rc_color=red
-	#	root_id_color=magenta
-# else						#  B/W terminal
-	#	dir_color=bw_bold
-	#	rc_color=bw_bold
+# if [ 0`tput colors` -ge 8 ];  then            #  if terminal supports colors
+        #       dir_color=CYAN
+        #       rc_color=red
+        #       root_id_color=magenta
+# else                                          #  B/W terminal
+        #       dir_color=bw_bold
+        #       rc_color=bw_bold
 # fi
 
 
@@ -56,21 +56,21 @@ cwd_cmd='cwd_truncate 40'	# display last 30 chars of path
 ### Variable name is uppercase-short-hostname with appended &quot;_host_color&quot;
 ### Example per-host-color config:  
 
-##	    TASHA_host_color=cyan
-##	       AL_host_color=green
-##	      AHP_host_color=white
+##          TASHA_host_color=cyan
+##             AL_host_color=green
+##            AHP_host_color=white
 
 
 #####  VCS (version control system)  state colors
 
-#		 init_vcs_color=WHITE     # initial
-#		clean_vcs_color=blue      # nothing to commit (working directory clean)
-#	     modified_vcs_color=red       # Changed but not updated:
-#		added_vcs_color=green     # Changes to be committed:
-#		mixed_vcs_color=yellow    # 
-#	    untracked_vcs_color=BLUE      # Untracked files:
-#		   op_vcs_color=MAGENTA
-#	     detached_vcs_color=RED
+#                init_vcs_color=WHITE     # initial
+#               clean_vcs_color=blue      # nothing to commit (working directory clean)
+#            modified_vcs_color=red       # Changed but not updated:
+#               added_vcs_color=green     # Changes to be committed:
+#               mixed_vcs_color=yellow    # 
+#           untracked_vcs_color=BLUE      # Untracked files:
+#                  op_vcs_color=MAGENTA
+#            detached_vcs_color=RED
 
 
-: vim:ft=sh ts=8:
+# :vim:ft=sh ts=8 sw=8 et:</diff>
      <filename>git-prompt.conf</filename>
    </modified>
    <modified>
      <diff>@@ -1,92 +1,87 @@
 
-# don't set prompt if this is not interactive shell
-[[ $- != *i* ]]  &amp;&amp;  return
+        # don't set prompt if this is not interactive shell
+        [[ $- != *i* ]]  &amp;&amp;  return
 
 ###################################################################   CONFIG
 
-	#####  read config file if any.
+        #####  read config file if any.
 
-	unset 	dir_color rc_color root_id_color init_vcs_color clean_vcs_color
-	unset modified_vcs_color added_vcs_color mixed_vcs_color untracked_vcs_color op_vcs_color detached_vcs_color
+        unset   dir_color rc_color root_id_color init_vcs_color clean_vcs_color
+        unset modified_vcs_color added_vcs_color mixed_vcs_color untracked_vcs_color op_vcs_color detached_vcs_color
 
-	conf=git-prompt.conf; 			[[ -r $conf ]]  &amp;&amp; . $conf
-	conf=/etc/git-prompt.conf; 		[[ -r $conf ]]  &amp;&amp; . $conf
-	conf=~/.git-prompt.conf;  		[[ -r $conf ]]  &amp;&amp; . $conf
-	unset conf
+        conf=git-prompt.conf;                   [[ -r $conf ]]  &amp;&amp; . $conf
+        conf=/etc/git-prompt.conf;              [[ -r $conf ]]  &amp;&amp; . $conf
+        conf=~/.git-prompt.conf;                [[ -r $conf ]]  &amp;&amp; . $conf
+        unset conf
 
-	#####  set defaults if not set
+        #####  set defaults if not set
 
-	git_module=${git_module:-on}
-	svn_module=${svn_module:-off}
-	hg_module=${hg_module:-on}
-	vim_module=${vim_module:-on}
-	error_bell=${error_bell:-off}
+        git_module=${git_module:-on}
+        svn_module=${svn_module:-off}
+        hg_module=${hg_module:-on}
+        vim_module=${vim_module:-on}
+        error_bell=${error_bell:-off}
 
 
-	#### dir, rc, root color 
-	if [ 0`tput colors` -ge 8 ];  then				#  if terminal supports colors
-		dir_color=${dir_color:-CYAN}
-		rc_color=${rc_color:-red}
-		root_id_color=${root_id_color:-magenta}
-	else											#  only B/W
-		dir_color=${dir_color:-bw_bold}
-		rc_color=${rc_color:-bw_bold}
-	fi
-
-	#### vcs state colors
-		 init_vcs_color=${init_vcs_color:-WHITE}		# initial
-		clean_vcs_color=${clean_vcs_color:-blue}		# nothing to commit (working directory clean)
-	     modified_vcs_color=${modified_vcs_color:-red}	# Changed but not updated:
-		added_vcs_color=${added_vcs_color:-green}	# Changes to be committed:
-		mixed_vcs_color=${mixed_vcs_color:-yellow}
-	    untracked_vcs_color=${untracked_vcs_color:-BLUE}	# Untracked files:
-		   op_vcs_color=${op_vcs_color:-MAGENTA}
-	     detached_vcs_color=${detached_vcs_color:-RED}
-
-	max_file_list_length=${max_file_list_length:-100}
+        #### dir, rc, root color 
+        if [ 0`tput colors` -ge 8 ];  then                              #  if terminal supports colors
+                dir_color=${dir_color:-CYAN}
+                rc_color=${rc_color:-red}
+                root_id_color=${root_id_color:-magenta}
+        else                                                                                    #  only B/W
+                dir_color=${dir_color:-bw_bold}
+                rc_color=${rc_color:-bw_bold}
+        fi
 
-   truncate_pwd=${truncate_pwd:-off}
-   max_pwd_length=${max_pwd_length:-30}
-   min_chars_per_pwd=${min_chars_per_pwd:-1}
+        #### vcs state colors
+                 init_vcs_color=${init_vcs_color:-WHITE}                # initial
+                clean_vcs_color=${clean_vcs_color:-blue}                # nothing to commit (working directory clean)
+             modified_vcs_color=${modified_vcs_color:-red}      # Changed but not updated:
+                added_vcs_color=${added_vcs_color:-green}       # Changes to be committed:
+                mixed_vcs_color=${mixed_vcs_color:-yellow}
+            untracked_vcs_color=${untracked_vcs_color:-BLUE}    # Untracked files:
+                   op_vcs_color=${op_vcs_color:-MAGENTA}
+             detached_vcs_color=${detached_vcs_color:-RED}
 
-   upcase_hostname=${upcase_hostname:-on}
+        max_file_list_length=${max_file_list_length:-100}
+        upcase_hostname=${upcase_hostname:-on}
 
 
 #####################################################################  post config
 
-	################# make PARSE_VCS_STATUS
-								    PARSE_VCS_STATUS=&quot;&quot;
-	[[ $git_module = &quot;on&quot; ]]   &amp;&amp;   type git &gt;&amp;/dev/null   &amp;&amp;   PARSE_VCS_STATUS=&quot;parse_git_status&quot;
-	[[ $svn_module = &quot;on&quot; ]]   &amp;&amp;   type svn &gt;&amp;/dev/null   &amp;&amp;   PARSE_VCS_STATUS+=&quot;||parse_svn_status&quot;
-	[[ $hg_module  = &quot;on&quot; ]]   &amp;&amp;   type hg  &gt;&amp;/dev/null   &amp;&amp;   PARSE_VCS_STATUS+=&quot;||parse_hg_status&quot;
-	                                                            PARSE_VCS_STATUS+=&quot;||return&quot;
-	################# terminfo colors-16
-	#
-	#  	black?    0 8			  
-	#	red       1 9
-	#	green     2 10
-	#	yellow    3 11
-	#	blue      4 12
-	#	magenta   5 13
-	#	cyan      6 14
-	#	white     7 15
-	#
-	#	terminfo setaf/setab - sets ansi foreground/background
-	#	terminfo sgr0 - resets all attributes
-	#	terminfo colors - number of colors
-	#
-	#################  Colors-256
-	#  To use foreground and background colors from the extension, you only
-	#  have to remember two escape codes:
-	#       Set the foreground color to index N:    \033[38;5;${N}m
-	#       Set the background color to index M:    \033[48;5;${M}m
-	# To make vim aware of a present 256 color extension, you can either set
-	# the $TERM environment variable to xterm-256color or use vim's -T option
-	# to set the terminal. I'm using an alias in my bashrc to do this. At the
-	# moment I only know of two color schemes which is made for multi-color
-	# terminals like urxvt (88 colors) or xterm: inkpot and desert256, 
-
-	### if term support colors,  then use color prompt, else bold
+        ################# make PARSE_VCS_STATUS
+                                                                    PARSE_VCS_STATUS=&quot;&quot;
+        [[ $git_module = &quot;on&quot; ]]   &amp;&amp;   type git &gt;&amp;/dev/null   &amp;&amp;   PARSE_VCS_STATUS=&quot;parse_git_status&quot;
+        [[ $svn_module = &quot;on&quot; ]]   &amp;&amp;   type svn &gt;&amp;/dev/null   &amp;&amp;   PARSE_VCS_STATUS+=&quot;||parse_svn_status&quot;
+        [[ $hg_module  = &quot;on&quot; ]]   &amp;&amp;   type hg  &gt;&amp;/dev/null   &amp;&amp;   PARSE_VCS_STATUS+=&quot;||parse_hg_status&quot;
+                                                                    PARSE_VCS_STATUS+=&quot;||return&quot;
+        ################# terminfo colors-16
+        #
+        #       black?    0 8                     
+        #       red       1 9
+        #       green     2 10
+        #       yellow    3 11
+        #       blue      4 12
+        #       magenta   5 13
+        #       cyan      6 14
+        #       white     7 15
+        #
+        #       terminfo setaf/setab - sets ansi foreground/background
+        #       terminfo sgr0 - resets all attributes
+        #       terminfo colors - number of colors
+        #
+        #################  Colors-256
+        #  To use foreground and background colors from the extension, you only
+        #  have to remember two escape codes:
+        #       Set the foreground color to index N:    \033[38;5;${N}m
+        #       Set the background color to index M:    \033[48;5;${M}m
+        # To make vim aware of a present 256 color extension, you can either set
+        # the $TERM environment variable to xterm-256color or use vim's -T option
+        # to set the terminal. I'm using an alias in my bashrc to do this. At the
+        # moment I only know of two color schemes which is made for multi-color
+        # terminals like urxvt (88 colors) or xterm: inkpot and desert256, 
+
+        ### if term support colors,  then use color prompt, else bold
 
               black='\['`tput sgr0; tput setaf 0`'\]'
                 red='\['`tput sgr0; tput setaf 1`'\]'
@@ -108,208 +103,201 @@
 
             bw_bold='\['`tput bold`'\]'
 
-	on=''
-	off=': '
-
-	bell=&quot;\[`eval ${!error_bell} tput bel`\]&quot;
+        on=''
+        off=': '
+        
+        bell=&quot;\[`eval ${!error_bell} tput bel`\]&quot;
 
-       colors_reset='\['`tput sgr0`'\]'
+        colors_reset='\['`tput sgr0`'\]'
 
-	# Workaround for UTF readline(?) bug. Disable bell when UTF
-	#locale |grep -qi UTF &amp;&amp; bell=''	
+        # Workaround for UTF readline(?) bug. Disable bell when UTF
+        #locale |grep -qi UTF &amp;&amp; bell=''        
 
 
-	# replace symbolic colors names to raw treminfo strings
-		 init_vcs_color=${!init_vcs_color}
-	     modified_vcs_color=${!modified_vcs_color}
-	    untracked_vcs_color=${!untracked_vcs_color}
-		clean_vcs_color=${!clean_vcs_color}
-		added_vcs_color=${!added_vcs_color}
-		   op_vcs_color=${!op_vcs_color}
-		mixed_vcs_color=${!mixed_vcs_color}
-	     detached_vcs_color=${!detached_vcs_color}
+        # replace symbolic colors names to raw treminfo strings
+                 init_vcs_color=${!init_vcs_color}
+             modified_vcs_color=${!modified_vcs_color}
+            untracked_vcs_color=${!untracked_vcs_color}
+                clean_vcs_color=${!clean_vcs_color}
+                added_vcs_color=${!added_vcs_color}
+                   op_vcs_color=${!op_vcs_color}
+                mixed_vcs_color=${!mixed_vcs_color}
+             detached_vcs_color=${!detached_vcs_color}
 
-	##################################################################### 
-	# if label non empty, append 1 space
-	label=${1:+$1 }
+        ##################################################################### 
+        # if label non empty, append 1 space
+        label=${1:+$1 }
 
 
-	unset PROMPT_COMMAND
+        unset PROMPT_COMMAND
 
-	#######  work around for MC bug
-	if [ -z &quot;$TERM&quot; -o &quot;$TERM&quot; = &quot;dumb&quot; -o -n &quot;$MC_SID&quot; ]; then
-		unset PROMPT_COMMAND
-		PS1='\w&gt; '
-		return 0
-	fi
+        #######  work around for MC bug
+        if [ -z &quot;$TERM&quot; -o &quot;$TERM&quot; = &quot;dumb&quot; -o -n &quot;$MC_SID&quot; ]; then
+                unset PROMPT_COMMAND
+                PS1='\w&gt; '
+                return 0
+        fi
 
-	export who_where
+        export who_where
 
-truncate_working_directory() {
-	pwd=`echo $PWD | sed &quot;s:^${HOME}:~:&quot;`
-	[[ $truncate_pwd != &quot;on&quot; ]] &amp;&amp; return
-	chars_per_dir=5
-	while [[ $((chars_per_dir--)) -gt $((min_chars_per_pwd)) &amp;&amp; `echo ${pwd} | wc -m` -gt $((max_pwd_length)) ]]; do
-	   pwd=`echo ${pwd} | sed &quot;s:[^\/~]*\(/.\{${chars_per_dir}\}\):\1:g&quot;`
-	done
-	unset chars_per_dir
- }
 
 cwd_truncate() {
-	# https://www.blog.montgomerie.net/pwd-in-the-title-bar-or-a-regex-adventure-in-bash
-
-	[[ $truncate_pwd != &quot;on&quot; ]] &amp;&amp; return
-
-	local pwd_length=$1
+        # based on:   https://www.blog.montgomerie.net/pwd-in-the-title-bar-or-a-regex-adventure-in-bash
+        # TODO: never abbrivate last  dir
 
-	# Get the current working directory. We'll format it in $dir.
-	local dir=&quot;$PWD&quot;
+        [[ $truncate_pwd != &quot;on&quot; ]] &amp;&amp; return
 
-	# Substitute a leading path that's in $HOME for &quot;~&quot;
-	if [[ &quot;$HOME&quot; == ${dir:0:${#HOME}} ]] ; then
-		dir=&quot;~${dir:${#HOME}}&quot;
-	fi
+        local pwd_length=$1
 
-	# Append a trailing slash if it's not there already.
-	#if [[ ${dir:${#dir}-1} != &quot;/&quot; ]] ; then
-	#	dir=&quot;$dir/&quot;
-	#fi
+        # Get the current working directory. We'll format it in $dir.
+        local dir=&quot;$PWD&quot;
 
-	# Truncate if we're too long.
-	# We preserve the leading '/' or '~/', and substitute
-	# ellipses for some directories in the middle.
-	if [[ &quot;$dir&quot; =~ (~){0,1}/.*(.{${pwd_length}}) ]] ; then
-		local tilde=${BASH_REMATCH[1]}
-		local directory=${BASH_REMATCH[2]}
-
-		# At this point, $directory is the truncated end-section of the
-		# path. We will now make it only contain full directory names
-		# (e.g. &quot;ibrary/Mail&quot; -&gt; &quot;/Mail&quot;).
-		if [[ &quot;$directory&quot; =~ [^/]*(.*) ]] ; then
-			directory=${BASH_REMATCH[1]}
-		fi
+        # Substitute a leading path that's in $HOME for &quot;~&quot;
+        if [[ &quot;$HOME&quot; == ${dir:0:${#HOME}} ]] ; then
+                dir=&quot;~${dir:${#HOME}}&quot;
+        fi
 
-		# Can't work out if it's possible to use the Unicode ellipsis,
-		# '&#8230;' (Unicode 2026). Directly embedding it in the string does not
-		# seem to work, and \u escape sequences ('\u2026') are not expanded.
-		#printf -v dir &quot;$tilde/\u2026$s&quot;, $directory&quot;
-		dir=&quot;$tilde/...$directory&quot;
-	fi
+        # Append a trailing slash if it's not there already.
+        #if [[ ${dir:${#dir}-1} != &quot;/&quot; ]] ; then
+        #       dir=&quot;$dir/&quot;
+        #fi
+
+        # Truncate if we're too long.
+        # We preserve the leading '/' or '~/', and substitute
+        # ellipses for some directories in the middle.
+        if [[ &quot;$dir&quot; =~ (~){0,1}/.*(.{${pwd_length}}) ]] ; then
+                local tilde=${BASH_REMATCH[1]}
+                local directory=${BASH_REMATCH[2]}
+
+                # At this point, $directory is the truncated end-section of the
+                # path. We will now make it only contain full directory names
+                # (e.g. &quot;ibrary/Mail&quot; -&gt; &quot;/Mail&quot;).
+                if [[ &quot;$directory&quot; =~ [^/]*(.*) ]] ; then
+                        directory=${BASH_REMATCH[1]}
+                fi
+
+                # Can't work out if it's possible to use the Unicode ellipsis,
+                # '&#8230;' (Unicode 2026). Directly embedding it in the string does not
+                # seem to work, and \u escape sequences ('\u2026') are not expanded.
+                #printf -v dir &quot;$tilde/\u2026$s&quot;, $directory&quot;
+                dir=&quot;$tilde/...$directory&quot;
+        fi
 
-	cwd=&quot;$dir&quot;
-}
+        cwd=&quot;$dir&quot;
+ }
 
 
 set_shell_title() { 
 
-	xterm_title() { echo  -n &quot;*]2;${@}*&quot; ; }   # FIXME: replace hardcodes with terminfo codes
+        xterm_title() { echo  -n &quot;*]2;${@}*&quot; ; }   # FIXME: replace hardcodes with terminfo codes
 
-	screen_title() { 
-		# FIXME: run this only if screen is in xterm (how to test for this?)
-		xterm_title  &quot;sCRn  $label$plain_who_where $@&quot; 
+        screen_title() { 
+                # FIXME: run this only if screen is in xterm (how to test for this?)
+                xterm_title  &quot;sCRn  $label$plain_who_where $@&quot; 
 
-		# FIXME $STY not inherited though &quot;su -&quot;
-		[ &quot;$STY&quot; ] &amp;&amp; screen -S $STY -X title &quot;$*&quot;
-	}
+                # FIXME $STY not inherited though &quot;su -&quot;
+                [ &quot;$STY&quot; ] &amp;&amp; screen -S $STY -X title &quot;$*&quot;
+        }
 
-	case $TERM in
+        case $TERM in
 
-		screen*)                                                    
-			screen_title &quot;$*&quot;
-			;;
+                screen*)                                                    
+                        screen_title &quot;$*&quot;
+                        ;;
 
-		xterm* | rxvt* | gnome-terminal | konsole | eterm | wterm )       
-			# is there a capability which we can to test 
-			# for &quot;set term title-bar&quot; and its escapes?
-			#echo -n &quot;*]2;$label$plain_who_where $1*&quot;
-			xterm_title  &quot;$label$plain_who_where $@&quot;
-			;;
+                xterm* | rxvt* | gnome-terminal | konsole | eterm | wterm )       
+                        # is there a capability which we can to test 
+                        # for &quot;set term title-bar&quot; and its escapes?
+                        #echo -n &quot;*]2;$label$plain_who_where $1*&quot;
+                        xterm_title  &quot;$label$plain_who_where $@&quot;
+                        ;;
 
-		*)                                                     
-			;;
-	esac
+                *)                                                     
+                        ;;
+        esac
  }
 
     export -f set_shell_title
 
 ###################################################### ID (user name)
-	id=`id -un`
-	id=${id#$default_user}
+        id=`id -un`
+        id=${id#$default_user}
 
 ########################################################### TTY
-	tty=`tty`
-	tty=`echo $tty | sed &quot;s:/dev/pts/:p:; s:/dev/tty::&quot; `		# RH tty devs	
-	tty=`echo $tty | sed &quot;s:/dev/vc/:vc:&quot; `				# gentoo tty devs
-
-	if [[ &quot;$TERM&quot; = &quot;screen&quot; ]] ;  then
-
-		#	[ &quot;$WINDOW&quot; = &quot;&quot; ] &amp;&amp; WINDOW=&quot;?&quot;
-		#	
-		#		# if under screen then make tty name look like s1-p2
-		#		# tty=&quot;${WINDOW:+s}$WINDOW${WINDOW:+-}$tty&quot;
-		#	tty=&quot;${WINDOW:+s}$WINDOW&quot;  # replace tty name with screen number
-		tty=&quot;$WINDOW&quot;  # replace tty name with screen number
-	fi
-
-	# we don't need tty name under X11
-	case $TERM in
-		xterm* | rxvt* | gnome-terminal | konsole | eterm | wterm )  unset tty ;;
-		*);;
-	esac
-
-	dir_color=${!dir_color}
-	rc_color=${!rc_color}
-	root_id_color=${!root_id_color}
-
-	########################################################### HOST
-	### we don't display home host/domain  $SSH_* set by SSHD or keychain
-
-	# How to find out if session is local or remote? Working with &quot;su -&quot;, ssh-agent, and so on ? 
-	## is sshd our parent?
-	# if 	{ for ((pid=$$; $pid != 1 ; pid=`ps h -o pid --ppid $pid`)); do ps h -o command -p $pid; done | grep -q sshd &amp;&amp; echo == REMOTE ==; }
-	#then 
-	host=${HOSTNAME}
-	#host=`hostname --short`
-	if [[ $upcase_hostname = &quot;on&quot; ]]; then 
-		host=`echo ${host%$default_host} | tr a-z A-Z`
-	else
-		host=${host%$default_host}
-	fi
-	
+        tty=`tty`
+        tty=`echo $tty | sed &quot;s:/dev/pts/:p:; s:/dev/tty::&quot; `           # RH tty devs   
+        tty=`echo $tty | sed &quot;s:/dev/vc/:vc:&quot; `                         # gentoo tty devs
+
+        if [[ &quot;$TERM&quot; = &quot;screen&quot; ]] ;  then
+
+                #       [ &quot;$WINDOW&quot; = &quot;&quot; ] &amp;&amp; WINDOW=&quot;?&quot;
+                #       
+                #               # if under screen then make tty name look like s1-p2
+                #               # tty=&quot;${WINDOW:+s}$WINDOW${WINDOW:+-}$tty&quot;
+                #       tty=&quot;${WINDOW:+s}$WINDOW&quot;  # replace tty name with screen number
+                tty=&quot;$WINDOW&quot;  # replace tty name with screen number
+        fi
+
+        # we don't need tty name under X11
+        case $TERM in
+                xterm* | rxvt* | gnome-terminal | konsole | eterm | wterm )  unset tty ;;
+                *);;
+        esac
+
+        dir_color=${!dir_color}
+        rc_color=${!rc_color}
+        root_id_color=${!root_id_color}
+
+        ########################################################### HOST
+        ### we don't display home host/domain  $SSH_* set by SSHD or keychain
+
+        # How to find out if session is local or remote? Working with &quot;su -&quot;, ssh-agent, and so on ? 
+        ## is sshd our parent?
+        # if    { for ((pid=$$; $pid != 1 ; pid=`ps h -o pid --ppid $pid`)); do ps h -o command -p $pid; done | grep -q sshd &amp;&amp; echo == REMOTE ==; }
+        #then 
+        host=${HOSTNAME}
+        #host=`hostname --short`
+        if [[ $upcase_hostname = &quot;on&quot; ]]; then 
+                host=`echo ${host%$default_host} | tr a-z A-Z`
+        else
+                host=${host%$default_host}
+        fi
+        
         host_color=${host}_host_color
         host_color=${!host_color}
         if [[ -z $host_color &amp;&amp; -x /usr/bin/cksum ]] ;  then 
-		cksum_color_no=`echo $host | cksum  | awk '{print $1%7}'`
-		color_index=(green yellow blue magenta cyan white)		# FIXME:  bw,  color-256
-		host_color=${color_index[cksum_color_no]}
-	fi
+                cksum_color_no=`echo $host | cksum  | awk '{print $1%7}'`
+                color_index=(green yellow blue magenta cyan white)              # FIXME:  bw,  color-256
+                host_color=${color_index[cksum_color_no]}
+        fi
 
-	host_color=${!host_color}
+        host_color=${!host_color}
 
-	# we already should have short host name, but just in case
-	host=${host%.$localdomain}
-	host=${host%.$default_domain}
+        # we already should have short host name, but just in case
+        host=${host%.$localdomain}
+        host=${host%.$default_domain}
 
 
 #################################################################### WHO_WHERE 
-	#  [[user@]host[-tty]]
-	
-	if [[ -n $id  || -n $host ]] ;   then 
-		[[ -n $id  &amp;&amp;  -n $host ]]  &amp;&amp;  at='@'  || at=''
-		color_who_where=&quot;${id}$at${host:+$host_color$host}${tty:+ $tty}&quot;
-		plain_who_where=&quot;${id}$at$host&quot;
-
-		# add trailing &quot; &quot;
-		color_who_where=&quot;$color_who_where &quot;
-		plain_who_where=&quot;$plain_who_where &quot;
-		
-		# if root then make it root_color
-		if	[ &quot;$id&quot; == &quot;root&quot; ]  ; then 
-		    color_who_where=&quot;$root_id_color$color_who_where$colors_reset&quot;
-		fi
-	else
-		    color_who_where=''
-	fi
+        #  [[user@]host[-tty]]
+        
+        if [[ -n $id  || -n $host ]] ;   then 
+                [[ -n $id  &amp;&amp;  -n $host ]]  &amp;&amp;  at='@'  || at=''
+                color_who_where=&quot;${id}$at${host:+$host_color$host}${tty:+ $tty}&quot;
+                plain_who_where=&quot;${id}$at$host&quot;
+
+                # add trailing &quot; &quot;
+                color_who_where=&quot;$color_who_where &quot;
+                plain_who_where=&quot;$plain_who_where &quot;
+                
+                # if root then make it root_color
+                if      [ &quot;$id&quot; == &quot;root&quot; ]  ; then 
+                    color_who_where=&quot;$root_id_color$color_who_where$colors_reset&quot;
+                fi
+        else
+                color_who_where=''
+        fi
+                
 
 parse_svn_status() {
 
@@ -330,39 +318,39 @@ parse_svn_status() {
         unset status modified added clean init added mixed untracked op detached
         eval `svn status 2&gt;/dev/null |
                 sed -n '
-                    s/^A      \([^.].*\)/modified=modified;		modified_files[${#modified_files[@]}+1]=\&quot;\1\&quot;;/p
-                    s/^M      \([^.].*\)/modified=modified;		modified_files[${#modified_files[@]}+1]=\&quot;\1\&quot;;/p
-                    s/^\?      \([^.].*\)/untracked=untracked;	untracked_files[${#untracked_files[@]}+1]=\&quot;\1\&quot;;/p
+                    s/^A      \([^.].*\)/modified=modified;             modified_files[${#modified_files[@]}+1]=\&quot;\1\&quot;;/p
+                    s/^M      \([^.].*\)/modified=modified;             modified_files[${#modified_files[@]}+1]=\&quot;\1\&quot;;/p
+                    s/^\?      \([^.].*\)/untracked=untracked;  untracked_files[${#untracked_files[@]}+1]=\&quot;\1\&quot;;/p
                 ' 
         `
         # TODO branch detection if standard repo layout
 
-        [[  -z $modified ]]  &amp;&amp; [[ -z $untracked ]] &amp;&amp; clean=clean
+        [[  -z $modified ]]   &amp;&amp;  [[ -z $untracked ]]  &amp;&amp;  clean=clean
         vcs_info=svn:r$rev
  }
         
 parse_hg_status() {
-
-  [[  -d ./.hg/ ]]  ||  return  1
-
-  vcs=hg
-
-  ### get status
-  unset status modified added clean init added mixed untracked op detached
-
-  eval `hg status 2&gt;/dev/null |
-    sed -n '
-      s/^M \([^.].*\)/modified=modified; modified_files[${#modified_files[@]}+1]=\&quot;\1\&quot;;/p
-      s/^A \([^.].*\)/added=added; added_files[${#added_files[@]}+1]=\&quot;\1\&quot;;/p
-      s/^R \([^.].*\)/added=added;/p
-      s/^! \([^.].*\)/modified=modified;/p
-      s/^? \([^.].*\)/untracked=untracked; untracked_files[${#untracked_files[@]}+1]=\\&quot;\1\\&quot;;/p
-    '`
-
-  branch=`hg branch 2&gt; /dev/null`
-
-  [[ -z $modified ]] &amp;&amp; [[ -z $untracked ]] &amp;&amp; [[ -z $added ]] &amp;&amp; clean=clean
-  vcs_info=${branch/default/D}
+        
+        [[  -d ./.hg/ ]]  ||  return  1
+        
+        vcs=hg
+        
+        ### get status
+        unset status modified added clean init added mixed untracked op detached
+        
+        eval `hg status 2&gt;/dev/null |
+                sed -n '
+                        s/^M \([^.].*\)/modified=modified; modified_files[${#modified_files[@]}+1]=\&quot;\1\&quot;;/p
+                        s/^A \([^.].*\)/added=added; added_files[${#added_files[@]}+1]=\&quot;\1\&quot;;/p
+                        s/^R \([^.].*\)/added=added;/p
+                        s/^! \([^.].*\)/modified=modified;/p
+                        s/^? \([^.].*\)/untracked=untracked; untracked_files[${#untracked_files[@]}+1]=\\&quot;\1\\&quot;;/p
+        '`
+        
+        branch=`hg branch 2&gt; /dev/null`
+        
+        [[ -z $modified ]]   &amp;&amp;   [[ -z $untracked ]]   &amp;&amp;   [[ -z $added ]]   &amp;&amp;   clean=clean
+        vcs_info=${branch/default/D}
  }
 
 parse_git_status() {
@@ -379,44 +367,44 @@ parse_git_status() {
         unset status modified added clean init added mixed untracked op detached
         eval `
                 git status 2&gt;/dev/null |
-                    sed -n '
-                        s/^# On branch /branch=/p
-                        s/^nothing to commit (working directory clean)/clean=clean/p
-                        s/^# Initial commit/init=init/p
-
-			s/^#	\.\./: SKIP/
-
-                        /^# Untracked files:/,/^[^#]/{
-                            s/^# Untracked files:/untracked=untracked;/p
-                            s/^#	\(.*\)/untracked_files[${#untracked_files[@]}+1]=\\&quot;\1\\&quot;/p   
-                        }
-
-                        /^# Changed but not updated:/,/^# [A-Z]/ {
-                            s/^# Changed but not updated:/modified=modified;/p
-                            s/^#	modified:   \.\./: SKIP/
-                            s/^#	modified:   \(.*\)/modified_files[${#modified_files[@]}+1]=\&quot;\1\&quot;/p
-                            s/^#	unmerged:   \.\./: SKIP/
-                            s/^#	unmerged:   \(.*\)/modified_files[${#modified_files[@]}+1]=\&quot;\1\&quot;/p
-                        }
-
-                        /^# Changes to be committed:/,/^# [A-Z]/ {
-                            s/^# Changes to be committed:/added=added;/p
-
-                            s/^#	modified:   \.\./: SKIP/
-                            s/^#	new file:   \.\./: SKIP/
-                            s/^#	renamed:[^&gt;]*&gt; \.\./: SKIP/
-                            s/^#	copied:[^&gt;]*&gt; \.\./: SKIP/
-
-                            s/^#	modified:   \(.*\)/added_files[${#added_files[@]}+1]=\&quot;\1\&quot;/p
-                            s/^#	new file:   \(.*\)/added_files[${#added_files[@]}+1]=\&quot;\1\&quot;/p
-                            s/^#	renamed:[^&gt;]*&gt; \(.*\)/added_files[${#added_files[@]}+1]=\&quot;\1\&quot;/p
-                            s/^#	copied:[^&gt;]*&gt; \(.*\)/added_files[${#added_files[@]}+1]=\&quot;\1\&quot;/p
-                        }
-                    ' 
+                        sed -n '
+                                s/^# On branch /branch=/p
+                                s/^nothing to commit (working directory clean)/clean=clean/p
+                                s/^# Initial commit/init=init/p
+
+                                s/^#    \.\./: SKIP/
+                                
+                                /^# Untracked files:/,/^[^#]/{
+                                        s/^# Untracked files:/untracked=untracked;/p
+                                        s/^#    \(.*\)/untracked_files[${#untracked_files[@]}+1]=\\&quot;\1\\&quot;/p   
+                                }
+
+                                /^# Changed but not updated:/,/^# [A-Z]/ {
+                                        s/^# Changed but not updated:/modified=modified;/p
+                                        s/^#    modified:   \.\./: SKIP/
+                                        s/^#    modified:   \(.*\)/modified_files[${#modified_files[@]}+1]=\&quot;\1\&quot;/p
+                                        s/^#    unmerged:   \.\./: SKIP/
+                                        s/^#    unmerged:   \(.*\)/modified_files[${#modified_files[@]}+1]=\&quot;\1\&quot;/p
+                                }
+
+                                /^# Changes to be committed:/,/^# [A-Z]/ {
+                                        s/^# Changes to be committed:/added=added;/p
+
+                                        s/^#    modified:   \.\./: SKIP/
+                                        s/^#    new file:   \.\./: SKIP/
+                                        s/^#    renamed:[^&gt;]*&gt; \.\./: SKIP/
+                                        s/^#    copied:[^&gt;]*&gt; \.\./: SKIP/
+
+                                        s/^#    modified:   \(.*\)/added_files[${#added_files[@]}+1]=\&quot;\1\&quot;/p
+                                        s/^#    new file:   \(.*\)/added_files[${#added_files[@]}+1]=\&quot;\1\&quot;/p
+                                        s/^#    renamed:[^&gt;]*&gt; \(.*\)/added_files[${#added_files[@]}+1]=\&quot;\1\&quot;/p
+                                        s/^#    copied:[^&gt;]*&gt; \(.*\)/added_files[${#added_files[@]}+1]=\&quot;\1\&quot;/p
+                                }
+                        ' 
         `
 
         if  ! grep -q &quot;^ref:&quot; $git_dir/HEAD  2&gt;/dev/null;   then 
-            detached=detached
+                detached=detached
         fi
 
 
@@ -426,46 +414,44 @@ parse_git_status() {
         
         if [[ -d &quot;$git_dir/.dotest&quot; ]] ;  then
 
-            if [[ -f &quot;$git_dir/.dotest/rebasing&quot; ]] ;  then
-                op=&quot;rebase&quot;
+                if [[ -f &quot;$git_dir/.dotest/rebasing&quot; ]] ;  then
+                        op=&quot;rebase&quot;
 
-            elif [[ -f &quot;$git_dir/.dotest/applying&quot; ]] ; then
-                op=&quot;am&quot;
+                elif [[ -f &quot;$git_dir/.dotest/applying&quot; ]] ; then
+                        op=&quot;am&quot;
 
-            else
-                op=&quot;am/rebase&quot;
+                else
+                        op=&quot;am/rebase&quot;
 
-            fi
+                fi
 
         elif  [[ -f &quot;$git_dir/.dotest-merge/interactive&quot; ]] ;  then
-            op=&quot;rebase -i&quot;
-            # ??? branch=&quot;$(cat &quot;$git_dir/.dotest-merge/head-name&quot;)&quot;
+                op=&quot;rebase -i&quot;
+                # ??? branch=&quot;$(cat &quot;$git_dir/.dotest-merge/head-name&quot;)&quot;
 
         elif  [[ -d &quot;$git_dir/.dotest-merge&quot; ]] ;  then
-            op=&quot;rebase -m&quot;
-            # ??? branch=&quot;$(cat &quot;$git_dir/.dotest-merge/head-name&quot;)&quot;
+                op=&quot;rebase -m&quot;
+                # ??? branch=&quot;$(cat &quot;$git_dir/.dotest-merge/head-name&quot;)&quot;
             
         # lvv: not always works. Should  ./.dotest  be used instead?
         elif  [[ -f &quot;$git_dir/MERGE_HEAD&quot; ]] ;  then
-            op=&quot;merge&quot;
-            # ??? branch=&quot;$(git symbolic-ref HEAD 2&gt;/dev/null)&quot;
-            
+                op=&quot;merge&quot;
+                # ??? branch=&quot;$(git symbolic-ref HEAD 2&gt;/dev/null)&quot;
+                
         else
-            [[  -f &quot;$git_dir/BISECT_LOG&quot;  ]]   &amp;&amp;  op=&quot;bisect&quot;
-            # ??? branch=&quot;$(git symbolic-ref HEAD 2&gt;/dev/null)&quot; || \
-            #    branch=&quot;$(git describe --exact-match HEAD 2&gt;/dev/null)&quot; || \
-            #    branch=&quot;$(cut -c1-7 &quot;$git_dir/HEAD&quot;)...&quot;
+                [[  -f &quot;$git_dir/BISECT_LOG&quot;  ]]   &amp;&amp;  op=&quot;bisect&quot;
+                # ??? branch=&quot;$(git symbolic-ref HEAD 2&gt;/dev/null)&quot; || \
+                #    branch=&quot;$(git describe --exact-match HEAD 2&gt;/dev/null)&quot; || \
+                #    branch=&quot;$(cut -c1-7 &quot;$git_dir/HEAD&quot;)...&quot;
         fi
 
 
         ####  GET GIT HEX-REVISION
-
         rawhex=`git rev-parse HEAD 2&gt;/dev/null`
         rawhex=${rawhex/HEAD/}
         rawhex=${rawhex:0:6}
         
-        ### branch
-
+        #### branch
         branch=${branch/master/M}
 
                         # another method of above:
@@ -475,25 +461,25 @@ parse_git_status() {
         ### compose vcs_info
 
         if [[ $init ]];  then 
-            vcs_info=M$white=init
+                vcs_info=M$white=init
 
         else
-            if [[ &quot;$detached&quot; ]] ;  then     
-                branch=&quot;&lt;detached:`git name-rev --name-only HEAD 2&gt;/dev/null`&quot;
+                if [[ &quot;$detached&quot; ]] ;  then     
+                        branch=&quot;&lt;detached:`git name-rev --name-only HEAD 2&gt;/dev/null`&quot;
 
 
-            elif   [[ &quot;$op&quot; ]];  then
-                    branch=&quot;$op:$branch&quot;
-                    if [[ &quot;$op&quot; == &quot;merge&quot; ]] ;  then     
-                        branch+=&quot;&lt;--$(git name-rev --name-only $(&lt;$git_dir/MERGE_HEAD))&quot;
-                    fi
-                    #branch=&quot;&lt;$branch&gt;&quot;
-            fi
-            vcs_info=&quot;$branch$white=$rawhex&quot;
+                elif   [[ &quot;$op&quot; ]];  then
+                        branch=&quot;$op:$branch&quot;
+                        if [[ &quot;$op&quot; == &quot;merge&quot; ]] ;  then     
+                            branch+=&quot;&lt;--$(git name-rev --name-only $(&lt;$git_dir/MERGE_HEAD))&quot;
+                        fi
+                        #branch=&quot;&lt;$branch&gt;&quot;
+                fi
+                vcs_info=&quot;$branch$white=$rawhex&quot;
 
         fi
  }
-
+        
 
 parse_vcs_status() {
 
@@ -522,20 +508,20 @@ parse_vcs_status() {
 
         ### VIM  ( not yet works for multiple files )
         
-	if  [[ $vim_module = &quot;on&quot; ]] ;  then
-		unset vim_glob vim_file vim_files
-		old_nullglob=`shopt -p nullglob`
-		    shopt -s nullglob
-		    vim_glob=`echo .*.swp`
-		eval $old_nullglob
-
-		if [[ $vim_glob ]];  then  
-		    vim_file=${vim_glob#.}
-		    vim_file=${vim_file%.swp}
-		    # if swap is newer,  then unsaved vim session
-		    [[ .${vim_file}.swp -nt $vim_file ]]  &amp;&amp; vim_files=$vim_file
-		fi
-	fi
+        if  [[ $vim_module = &quot;on&quot; ]] ;  then
+                unset vim_glob vim_file vim_files
+                old_nullglob=`shopt -p nullglob`
+                    shopt -s nullglob
+                    vim_glob=`echo .*.swp`
+                eval $old_nullglob
+
+                if [[ $vim_glob ]];  then  
+                    vim_file=${vim_glob#.}
+                    vim_file=${vim_file%.swp}
+                    # if swap is newer,  then unsaved vim session
+                    [[ .${vim_file}.swp -nt $vim_file ]]  &amp;&amp; vim_files=$vim_file
+                fi
+        fi
 
 
         ### file list
@@ -546,12 +532,12 @@ parse_vcs_status() {
         [[ ${vim_files}          ]]  &amp;&amp;  file_list+=&quot; &quot;${RED}VIM:${vim_files}
         file_list=${file_list:+:$file_list}
 
-	if [[ ${#file_list} -gt $max_file_list_length ]]  ;  then
-		file_list=${file_list:0:$max_file_list_length} 	
-		if [[ $max_file_list_length -gt 0 ]]  ;  then
-			file_list=&quot;${file_list% *} ...&quot;
-		fi
-	fi
+        if [[ ${#file_list} -gt $max_file_list_length ]]  ;  then
+                file_list=${file_list:0:$max_file_list_length}  
+                if [[ $max_file_list_length -gt 0 ]]  ;  then
+                        file_list=&quot;${file_list% *} ...&quot;
+                fi
+        fi
 
 
         head_local=&quot;(${vcs_info}$vcs_color${file_list}$vcs_color)&quot;
@@ -563,34 +549,34 @@ parse_vcs_status() {
  }
 
 
- trap - DEBUG  &gt;&amp; /dev/null
- trap '[[ $BASH_COMMAND != prompt_command_function ]] &amp;&amp; set_shell_title $BASH_COMMAND' DEBUG  &gt;&amp; /dev/null
+        trap - DEBUG  &gt;&amp; /dev/null
+        trap '[[ $BASH_COMMAND != prompt_command_function ]] &amp;&amp; set_shell_title $BASH_COMMAND' DEBUG  &gt;&amp; /dev/null
 
 ###################################################################### PROMPT_COMMAND
 
 prompt_command_function() {
-	rc=&quot;$?&quot;
+        rc=&quot;$?&quot;
 
-	if [[ &quot;$rc&quot; == &quot;0&quot; ]]; then 
-		rc=&quot;&quot;
-	else
-		rc=&quot;$rc_color$rc$colors_reset$bell &quot;
-	fi
+        if [[ &quot;$rc&quot; == &quot;0&quot; ]]; then 
+                rc=&quot;&quot;
+        else
+                rc=&quot;$rc_color$rc$colors_reset$bell &quot;
+        fi
 
-	set_shell_title &quot;$PWD/&quot; 
-	parse_vcs_status
+        set_shell_title &quot;$PWD/&quot; 
+        parse_vcs_status
 
-	# if cwd_cmd have back-slash, then assign it value to cwd
-	# else eval cmd_cmd,  cwd should have path after exection
-	eval &quot;${cwd_cmd/\\/cwd=\\\\}&quot;		
+        # if cwd_cmd have back-slash, then assign it value to cwd
+        # else eval cmd_cmd,  cwd should have path after exection
+        eval &quot;${cwd_cmd/\\/cwd=\\\\}&quot;           
 
-	PS1=&quot;$colors_reset$rc$head_local$label$color_who_where$dir_color$cwd$tail_local$dir_color&gt; $colors_reset&quot;
-	
-	unset head_local tail_local pwd
+        PS1=&quot;$colors_reset$rc$head_local$label$color_who_where$dir_color$cwd$tail_local$dir_color&gt; $colors_reset&quot;
+        
+        unset head_local tail_local pwd
  }
     
-    PROMPT_COMMAND=prompt_command_function
+        PROMPT_COMMAND=prompt_command_function
 
-    unset rc id tty modified_files file_list  
+        unset rc id tty modified_files file_list  
 
-# vim: set syntax=sh:
+# vim: set ft=sh ts=8 sw=8 et:</diff>
      <filename>git-prompt.sh</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>fe3a155c8594644a7b81beb428b2b9bdbef2bda3</id>
    </parent>
  </parents>
  <author>
    <name>Leonid Volnitsky</name>
    <email>Leonid@Volnitsky.com</email>
  </author>
  <url>http://github.com/lvv/git-prompt/commit/8b42fd3974e734cb2d164299ccc3519d13789a10</url>
  <id>8b42fd3974e734cb2d164299ccc3519d13789a10</id>
  <committed-date>2009-07-02T05:52:28-07:00</committed-date>
  <authored-date>2009-07-02T05:52:28-07:00</authored-date>
  <message>fixed: consistant tabulation. tabstop=8, tabs replaced with spaces</message>
  <tree>456e83aeef690acc98cd6dc26e4cdc890df2da30</tree>
  <committer>
    <name>Leonid Volnitsky</name>
    <email>Leonid@Volnitsky.com</email>
  </committer>
</commit>
