diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2009-02-11 12:48:21 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2009-02-11 12:48:21 +0000 |
commit | 76f05a9932c5f9aa1ea7ea7bd1cf08f65fd43e7c (patch) | |
tree | 3e78e9e3f8708c66bdc1bbef25e92e666b163c43 /Functions/VCS_Info/Backends | |
parent | b0066bc2026553c41290bf709738bfaf3524216f (diff) | |
download | zsh-76f05a9932c5f9aa1ea7ea7bd1cf08f65fd43e7c.tar.gz zsh-76f05a9932c5f9aa1ea7ea7bd1cf08f65fd43e7c.tar.xz zsh-76f05a9932c5f9aa1ea7ea7bd1cf08f65fd43e7c.zip |
Frank Terbeck: 26549: VCS_Info improvements: check for changes in git
Diffstat (limited to 'Functions/VCS_Info/Backends')
11 files changed, 20 insertions, 12 deletions
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr index 31618d353..1030c06ab 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr @@ -22,5 +22,5 @@ fi rrn=${bzrbase:t} zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat bzrbr || bzrbr="%b:%r" zformat -f bzrbr "${bzrbr}" "b:${bzrinfo[2]}" "r:${bzrinfo[1]}" -VCS_INFO_formats '' "${bzrbr}" "${bzrbase}" +VCS_INFO_formats '' "${bzrbr}" "${bzrbase}" '' '' return 0 diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_cdv b/Functions/VCS_Info/Backends/VCS_INFO_get_data_cdv index be8b4d837..2c516ea4b 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_cdv +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_cdv @@ -7,5 +7,5 @@ local cdvbase cdvbase=${vcs_comm[basedir]} rrn=${cdvbase:t} -VCS_INFO_formats '' "${cdvbase:t}" "${cdvbase}" +VCS_INFO_formats '' "${cdvbase:t}" "${cdvbase}" '' '' return 0 diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs b/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs index fa1ceca02..1c222ceec 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs @@ -14,5 +14,5 @@ cvsbranch=$(< ./CVS/Repository) rrn=${cvsbase:t} cvsbranch=${cvsbranch##${rrn}/} [[ -z ${cvsbranch} ]] && cvsbranch=${rrn} -VCS_INFO_formats '' "${cvsbranch}" "${cvsbase}" +VCS_INFO_formats '' "${cvsbranch}" "${cvsbase}" '' '' return 0 diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_darcs b/Functions/VCS_Info/Backends/VCS_INFO_get_data_darcs index 9fd3554ca..a1ebbb6ea 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_darcs +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_darcs @@ -7,5 +7,5 @@ local darcsbase darcsbase=${vcs_comm[basedir]} rrn=${darcsbase:t} -VCS_INFO_formats '' "${darcsbase:t}" "${darcsbase}" +VCS_INFO_formats '' "${darcsbase:t}" "${darcsbase}" '' '' return 0 diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 23545e53c..75d39cc4a 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -3,7 +3,7 @@ ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions extendedglob NO_shwordsplit -local gitdir gitbase gitbranch gitaction +local gitdir gitbase gitbranch gitaction gitunstaged gitstaged VCS_INFO_git_getaction () { local gitaction='' gitdir=$1 @@ -96,9 +96,17 @@ if [[ -z ${gitdir} ]] || [[ -z ${gitbranch} ]] ; then return 1 fi +if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "check-for-changes" ; then + # Default: off - these are potentially expensive on big repositories + ${vcs_comm[cmd]} diff --no-ext-diff --ignore-submodules --quiet --exit-code || + gitunstaged=1 + ${vcs_comm[cmd]} diff-index --cached --quiet --ignore-submodules HEAD || + gitstaged=1 +fi + VCS_INFO_adjust gitaction="$(VCS_INFO_git_getaction ${gitdir})" gitbase=${PWD%/${$( ${vcs_comm[cmd]} rev-parse --show-prefix )%/##}} rrn=${gitbase:t} -VCS_INFO_formats "${gitaction}" "${gitbranch}" "${gitbase}" +VCS_INFO_formats "${gitaction}" "${gitbranch}" "${gitbase}" "${gitstaged}" "${gitunstaged}" return 0 diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg index af9d85c5f..fb7c45087 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg @@ -8,5 +8,5 @@ local hgbranch hgbase hgbase=${vcs_comm[basedir]} rrn=${hgbase:t} hgbranch=$(< ${hgbase}/.hg/branch) -VCS_INFO_formats '' "${hgbranch}" "${hgbase}" +VCS_INFO_formats '' "${hgbranch}" "${hgbase}" '' '' return 0 diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_mtn b/Functions/VCS_Info/Backends/VCS_INFO_get_data_mtn index 688c85eec..63f060163 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_mtn +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_mtn @@ -8,5 +8,5 @@ local mtnbranch mtnbase mtnbase=${vcs_comm[basedir]} rrn=${mtnbase:t} mtnbranch=${${(M)${(f)"$( ${vcs_comm[cmd]} status )"}:#(#s)Current branch:*}/*: /} -VCS_INFO_formats '' "${mtnbranch}" "${mtnbase}" +VCS_INFO_formats '' "${mtnbranch}" "${mtnbase}" '' '' return 0 diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4 b/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4 index dccd9d340..ac87fafe5 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4 +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4 @@ -21,4 +21,4 @@ p4branch="%b:%r" zformat -f p4branch "${p4branch}" "b:${p4info[Client_name]}" \ "r:$change" -VCS_INFO_formats '' "${p4branch}" "${p4base}" +VCS_INFO_formats '' "${p4branch}" "${p4base}" '' '' diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svk b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svk index fa9548c03..48e5edb2c 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svk +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svk @@ -9,5 +9,5 @@ svkbase=${vcs_comm[basedir]} rrn=${svkbase:t} zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat svkbranch || svkbranch="%b:%r" zformat -f svkbranch "${svkbranch}" "b:${vcs_comm[branch]}" "r:${vcs_comm[revision]}" -VCS_INFO_formats '' "${svkbranch}" "${svkbase}" +VCS_INFO_formats '' "${svkbranch}" "${svkbase}" '' '' return 0 diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn index 57ff5d8a1..e18080585 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn @@ -24,5 +24,5 @@ svnbase="$(VCS_INFO_realpath ${svnbase})" rrn=${svnbase:t} zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat svnbranch || svnbranch="%b:%r" zformat -f svnbranch "${svnbranch}" "b:${svninfo[URL]##*/}" "r:${svninfo[Revision]}" -VCS_INFO_formats '' "${svnbranch}" "${svnbase}" +VCS_INFO_formats '' "${svnbranch}" "${svnbase}" '' '' return 0 diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_tla b/Functions/VCS_Info/Backends/VCS_INFO_get_data_tla index cbc48c0a2..69a82eb19 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_tla +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_tla @@ -9,5 +9,5 @@ tlabase="$(VCS_INFO_realpath ${vcs_comm[basedir]})" rrn=${tlabase:t} # tree-id gives us something like 'foo@example.com/demo--1.0--patch-4', so: tlabranch=${${"$( ${vcs_comm[cmd]} tree-id )"}/*\//} -VCS_INFO_formats '' "${tlabranch}" "${tlabase}" +VCS_INFO_formats '' "${tlabranch}" "${tlabase}" '' '' return 0 |