Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
git.el: Display some information about the HEAD commit.
author
Alexandre Julliard
<julliard@winehq.org>
Mon, 26 Mar 2007 10:16:16 +0000
(12:16 +0200)
committer
Junio C Hamano
<junkio@cox.net>
Tue, 27 Mar 2007 19:52:41 +0000
(12:52 -0700)
Use git-log --pretty=oneline to print a short description of the
current HEAD (and merge heads if any) in the buffer header.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
contrib/emacs/git.el
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
89d5892
)
diff --git
a/contrib/emacs/git.el
b/contrib/emacs/git.el
index 5f22dec5f71bfe2cb983dd9eabbb1b848b252eba..2f9995ea3979350c7cd3883dfc6364e90b8d9bb2 100644
(file)
--- a/
contrib/emacs/git.el
+++ b/
contrib/emacs/git.el
@@
-263,6
+263,16
@@
and returns the process output as a string."
(locale-charset-to-coding-system repo-config))
'utf-8)))
(locale-charset-to-coding-system repo-config))
'utf-8)))
+(defun git-get-logoutput-coding-system ()
+ "Return the coding system used for git-log output."
+ (let ((repo-config (or (git-config "i18n.logoutputencoding")
+ (git-config "i18n.commitencoding"))))
+ (or git-commits-coding-system
+ (and repo-config
+ (fboundp 'locale-charset-to-coding-system)
+ (locale-charset-to-coding-system repo-config))
+ 'utf-8)))
+
(defun git-escape-file-name (name)
"Escape a file name if necessary."
(if (string-match "[\n\t\"\\]" name)
(defun git-escape-file-name (name)
"Escape a file name if necessary."
(if (string-match "[\n\t\"\\]" name)
@@
-406,6
+416,14
@@
and returns the process output as a string."
(push (match-string 0) heads))))
(nreverse heads)))
(push (match-string 0) heads))))
(nreverse heads)))
+(defun git-get-commit-description (commit)
+ "Get a one-line description of COMMIT."
+ (let ((coding-system-for-read (git-get-logoutput-coding-system)))
+ (let ((descr (git-call-process-env-string nil "log" "--max-count=1" "--pretty=oneline" commit)))
+ (if (and descr (string-match "\\`\\([0-9a-f]\\{40\\}\\) *\\(.*\\)$" descr))
+ (concat (substring (match-string 1 descr) 0 10) " - " (match-string 2 descr))
+ descr))))
+
;;;; File info structure
;;;; ------------------------------------------------------------
;;;; File info structure
;;;; ------------------------------------------------------------
@@
-573,7
+591,7
@@
and returns the process output as a string."
"Refresh the ewoc header and footer."
(let ((branch (git-symbolic-ref "HEAD"))
(head (if (git-empty-db-p) "Nothing committed yet"
"Refresh the ewoc header and footer."
(let ((branch (git-symbolic-ref "HEAD"))
(head (if (git-empty-db-p) "Nothing committed yet"
- (
substring (git-rev-parse "HEAD") 0 10
)))
+ (
git-get-commit-description "HEAD"
)))
(merge-heads (git-get-merge-heads)))
(ewoc-set-hf status
(format "Directory: %s\nBranch: %s\nHead: %s%s\n"
(merge-heads (git-get-merge-heads)))
(ewoc-set-hf status
(format "Directory: %s\nBranch: %s\nHead: %s%s\n"
@@
-584,7
+602,7
@@
and returns the process output as a string."
head
(if merge-heads
(concat "\nMerging: "
head
(if merge-heads
(concat "\nMerging: "
- (mapconcat (lambda (str) (
substring str 0 10)) merge-heads "
"))
+ (mapconcat (lambda (str) (
git-get-commit-description str)) merge-heads "\n
"))
""))
(if (ewoc-nth status 0) "" " No changes."))))
""))
(if (ewoc-nth status 0) "" " No changes."))))