diff lisp/vc-git.el @ 93333:53eee5c271f4

* vc.el: Add new backend function 'status-extra-headers. (vc-default-status-extra-headers): New function. (vc-status-headers): Call 'status-extra-headers. Add colors. * vc-git.el (vc-git-status-extra-headers): New function.
author Dan Nicolaescu <dann@ics.uci.edu>
date Fri, 28 Mar 2008 03:50:26 +0000
parents 231f72336aed
children 8e46096e0cb3
line wrap: on
line diff
--- a/lisp/vc-git.el	Fri Mar 28 02:47:59 2008 +0000
+++ b/lisp/vc-git.el	Fri Mar 28 03:50:26 2008 +0000
@@ -264,6 +264,18 @@
        `(vc-git-after-dir-status-stage1 (quote ,update-function) ,status-buffer)))
     (current-buffer)))
 
+(defun vc-git-status-extra-headers (dir)
+  (let ((str (with-output-to-string
+               (with-current-buffer standard-output
+                 (vc-git--out-ok "symbolic-ref" "HEAD")))))
+    (concat
+     (propertize "Branch     : " 'face 'font-lock-type-face)
+     (propertize 
+      (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str)
+	  (match-string 2 str)
+	"not (detached HEAD)")
+       'face 'font-lock-variable-name-face))))
+
 ;;; STATE-CHANGING FUNCTIONS
 
 (defun vc-git-create-repo ()