summaryrefslogtreecommitdiff
path: root/lisp/vc-git.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/vc-git.el')
-rw-r--r--lisp/vc-git.el16
1 files changed, 14 insertions, 2 deletions
diff --git a/lisp/vc-git.el b/lisp/vc-git.el
index 88946f160ff..d68b33be76a 100644
--- a/lisp/vc-git.el
+++ b/lisp/vc-git.el
@@ -57,7 +57,7 @@
;; - latest-on-branch-p (file) NOT NEEDED
;; * checkout-model (file) OK
;; - workfile-unchanged-p (file) OK
-;; - mode-line-string (file) NOT NEEDED
+;; - mode-line-string (file) OK
;; - dired-state-info (file) OK
;; STATE-CHANGING FUNCTIONS
;; * create-repo () OK
@@ -87,7 +87,7 @@
;; - comment-history (file) ??
;; - update-changelog (files) COULD BE SUPPORTED
;; * diff (file &optional rev1 rev2 buffer) OK
-;; - revision-completion-table (file) NOT SUPPORTED in emacs-22.x
+;; - revision-completion-table (file) NEEDED?
;; - diff-tree (dir &optional rev1 rev2) OK
;; - annotate-command (file buf &optional rev) OK
;; - annotate-time () OK
@@ -192,6 +192,18 @@
(defun vc-git-workfile-unchanged-p (file)
(eq 'up-to-date (vc-git-state file)))
+(defun vc-git-mode-line-string (file)
+ "Return string for placement into the modeline for FILE."
+ (let* ((branch (vc-git-workfile-version file))
+ (def-ml (vc-default-mode-line-string 'Git file))
+ (help-echo (get-text-property 0 'help-echo def-ml)))
+ (if (zerop (length branch))
+ (propertize
+ (concat def-ml "!")
+ 'help-echo (concat help-echo "\nNo current branch (detached HEAD)"))
+ (propertize def-ml
+ 'help-echo (concat help-echo "\nCurrent branch: " branch)))))
+
(defun vc-git-dired-state-info (file)
"Git-specific version of `vc-dired-state-info'."
(let ((git-state (vc-state file)))