zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH 1/2] Added Git example to vcs_info-example to show the remote branch name
@ 2010-08-02 18:36 Seth House
  2010-08-02 18:36 ` [PATCH 2/2] Changed Git revision lookup behavior to invoke Git directly Seth House
  0 siblings, 1 reply; 2+ messages in thread
From: Seth House @ 2010-08-02 18:36 UTC (permalink / raw)
  To: zsh-workers; +Cc: Seth House

---
 Misc/vcs_info-examples |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/Misc/vcs_info-examples b/Misc/vcs_info-examples
index b769906..bc10a21 100644
--- a/Misc/vcs_info-examples
+++ b/Misc/vcs_info-examples
@@ -178,6 +178,22 @@ function +vi-git-st() {
     hook_com[misc]+=${(j:/:)gitstatus}
 }
 
+### git: Show remote branch name for remote-tracking branches
+zstyle ':vcs_info:git*+set-message:*' hooks git-remotebranch
+
+function +vi-git-remotebranch() {
+    local remote
+
+    # Are we on a remote-tracking branch?
+    remote=${$(git rev-parse --verify ${hook_com[branch]}@{upstream} \
+        --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
+
+    if [[ -n ${remote} ]] ; then
+        hook_com[branch]="${hook_com[branch]} [${remote}]"
+    fi
+}
+
+
 ### hg: Show marker when the working directory is not on a branch head
 # This may indicate that running `hg up` will do something
 # NOTE: the branchheads.cache file is not updated with every Mercurial
-- 
1.7.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] Changed Git revision lookup behavior to invoke Git directly.
  2010-08-02 18:36 [PATCH 1/2] Added Git example to vcs_info-example to show the remote branch name Seth House
@ 2010-08-02 18:36 ` Seth House
  0 siblings, 0 replies; 2+ messages in thread
From: Seth House @ 2010-08-02 18:36 UTC (permalink / raw)
  To: zsh-workers; +Cc: Seth House

This fixes a bug where the revision was empty for the time between when
Git packs refs and you make a commit.
---
 Functions/VCS_Info/Backends/VCS_INFO_get_data_git |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 979f017..01bf9f3 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -101,11 +101,8 @@ VCS_INFO_git_getbranch () {
 
 gitdir=${vcs_comm[gitdir]}
 gitbranch="$(VCS_INFO_git_getbranch ${gitdir})"
-if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-revision && \
-    [[ ${gitbranch} == refs/* ]] && \
-    [[ -r "${gitdir}/${gitbranch}" ]] ; then
-
-    gitsha1="${"$(< $gitdir/$gitbranch)"}"
+if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-revision ; then
+    gitsha1=$(${vcs_comm[cmd]} rev-parse --quiet --verify HEAD)
 else
     gitsha1=''
 fi
-- 
1.7.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-02 18:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-02 18:36 [PATCH 1/2] Added Git example to vcs_info-example to show the remote branch name Seth House
2010-08-02 18:36 ` [PATCH 2/2] Changed Git revision lookup behavior to invoke Git directly Seth House

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).