Dynamic dir-change handling for git probe.
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
#if ( ! $?cshenv_gitdirs )
|
||||||
|
set cshenv_gitdirs=( /home/adam/cshenv:/home/adam/cshenv/.git )
|
||||||
|
|
||||||
|
set _masked_cwd=$cwd:as/ //
|
||||||
|
#echo "${_masked_cwd}"
|
||||||
|
set _search_key="${_masked_cwd}"
|
||||||
|
#echo "${_search_key}"
|
||||||
|
#echo "dirs $cshenv_gitdirs"
|
||||||
|
#echo "cache-match $cshenv_gitdirs:as/${_masked_cwd}//"
|
||||||
|
#echo "cache-match $cshenv_gitdirs:gx/^${_search_key}*/"
|
||||||
|
#set _cache_match = ( $cshenv_gitdirs:gx^${_search_key}* )
|
||||||
|
|
||||||
|
#if ( ${#_cache_match} == 1 ) then
|
||||||
|
#echo "Found ${_cache_match}"
|
||||||
|
#else
|
||||||
|
set _git_check=( `git rev-parse --git-dir |&cat` )
|
||||||
|
#if ( -d "${_git_check}" ) then
|
||||||
|
#echo "Found and installed ${_git_check} git dir"
|
||||||
|
#set _masked_git=$_git_check:as/ //
|
||||||
|
#set cshenv_dirs=( ${cshenv_dirs} "${_masked_cwd}${masked_git}" )
|
||||||
|
#else
|
||||||
|
#echo "Found no git dir for ${_masked_cwd}"
|
||||||
|
#set cshenv_dirs=( ${cshenv_dirs} "${_masked_cwd}" )
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
@@ -139,6 +139,9 @@ _debug "Done building unicode sigils table"
|
|||||||
alias precmd 'source ${CSHENV_DIR}/tcshrc.prompt.final'
|
alias precmd 'source ${CSHENV_DIR}/tcshrc.prompt.final'
|
||||||
#alias postcmd echo doit
|
#alias postcmd echo doit
|
||||||
|
|
||||||
|
# On dir change, check for things, like git dirs.
|
||||||
|
alias cwdcmd 'source ${CSHENV_DIR}/tcshrc.cmd.cwd'
|
||||||
|
|
||||||
set promptchars='%#'
|
set promptchars='%#'
|
||||||
|
|
||||||
set prompt_simple="%{${sgr_reset}%}[%n@%m: %c]%# "
|
set prompt_simple="%{${sgr_reset}%}[%n@%m: %c]%# "
|
||||||
|
|||||||
+6
-3
@@ -164,8 +164,10 @@ endif
|
|||||||
set git_prompt=""
|
set git_prompt=""
|
||||||
set git_prefix=""
|
set git_prefix=""
|
||||||
set git_tracking_stat=""
|
set git_tracking_stat=""
|
||||||
set git_branch=(`git branch --show-current -q |&cat`)
|
#set git_branch=(`git branch --show-current -q |&cat`)
|
||||||
if( ${#git_branch} <= 1 ) then
|
if( ${#_git_check} <= 1 ) then
|
||||||
|
set git_branch_text=( `cat ${_git_check}/HEAD` )
|
||||||
|
set git_branch=${git_branch_text[2]:s.refs/heads/..}
|
||||||
_debug "We see git branch |${git_branch}|"
|
_debug "We see git branch |${git_branch}|"
|
||||||
if( ${#git_branch} == 0 ) then
|
if( ${#git_branch} == 0 ) then
|
||||||
_debug "We see git branch with no elements, clearing..."
|
_debug "We see git branch with no elements, clearing..."
|
||||||
@@ -178,7 +180,8 @@ if( ${#git_branch} <= 1 ) then
|
|||||||
if( "${#git_branch}" == 1 ) then
|
if( "${#git_branch}" == 1 ) then
|
||||||
_debug "We see git branch |${git_branch[1]}|"
|
_debug "We see git branch |${git_branch[1]}|"
|
||||||
_debug "Doing Rev List"
|
_debug "Doing Rev List"
|
||||||
set git_counts=`git rev-list --count --left-right \@\{upstream\}..HEAD|&cat`
|
_debug "--git-dir=${_git_check}/"
|
||||||
|
set git_counts=`git --git-dir=${_git_check} rev-list --count --left-right \@\{upstream\}...HEAD|&cat`
|
||||||
_debug "Done with Rev List"
|
_debug "Done with Rev List"
|
||||||
_debug "Got: ${git_counts}"
|
_debug "Got: ${git_counts}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user