diff lisp/vc-git.el @ 105017:bfda253c8f66

(vc-git-dir-extra-headers): Show the remote location.
author Dan Nicolaescu <dann@ics.uci.edu>
date Tue, 15 Sep 2009 00:11:51 +0000
parents b3c2589ed19e
children f43dfae3e132
line wrap: on
line diff
--- a/lisp/vc-git.el	Mon Sep 14 23:28:40 2009 +0000
+++ b/lisp/vc-git.el	Tue Sep 15 00:11:51 2009 +0000
@@ -403,16 +403,38 @@
   (let ((str (with-output-to-string
                (with-current-buffer standard-output
                  (vc-git--out-ok "symbolic-ref" "HEAD"))))
-	(stash (vc-git-stash-list)))
+	(stash (vc-git-stash-list))
+	branch remote remote-url)
+    (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str)
+	(progn
+	  (setq branch (match-string 2 str))
+	  (message "branch (%s)" branch)
+	  (setq remote
+		(with-output-to-string
+		  (with-current-buffer standard-output
+		    (vc-git--out-ok "config" (concat "branch." branch ".remote")))))
+	  (when (string-match "\\([^\n]+\\)" remote)
+	    (setq remote (match-string 1 remote)))
+	  (when remote
+	    (setq remote-url
+		  (with-output-to-string
+		    (with-current-buffer standard-output
+		      (vc-git--out-ok "config" (concat "remote." remote ".url"))))))
+	  (when (string-match "\\([^\n]+\\)" remote-url)
+	    (setq remote-url (match-string 1 remote-url))))
+      "not (detached HEAD)")
     ;; FIXME: maybe use a different face when nothing is stashed.
     (when (string= stash "") (setq stash "Nothing stashed"))
     (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)
+     (propertize branch
+		 'face 'font-lock-variable-name-face)
+     (when remote
+       (concat
+	"\n"
+	(propertize "Remote     : " 'face 'font-lock-type-face)
+	(propertize remote-url
+		    'face 'font-lock-variable-name-face)))
      "\n"
      (propertize "Stash      : " 'face 'font-lock-type-face)
      (propertize