From: "David Kågedal" <davidk@lysator.liu.se>
To: git@vger.kernel.org
Subject: [PATCH 3/7] Handle uncommitted changes and cache descriptions
Date: Fri, 09 Feb 2007 09:20:38 +0100 [thread overview]
Message-ID: <87veibpwrt.fsf@morpheus.local> (raw)
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---
contrib/emacs/git-blame.el | 26 ++++++++++++++++++++------
1 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/contrib/emacs/git-blame.el b/contrib/emacs/git-blame.el
index 56a548b..c99437e 100644
--- a/contrib/emacs/git-blame.el
+++ b/contrib/emacs/git-blame.el
@@ -187,8 +187,10 @@
(res-line (string-to-number (match-string 3)))
(num-lines (string-to-number (match-string 4))))
(setq git-blame-current
- (git-blame-new-commit
- hash src-line res-line num-lines)))
+ (if (string= hash "0000000000000000000000000000000000000000")
+ nil
+ (git-blame-new-commit
+ hash src-line res-line num-lines))))
(delete-region (point) (match-end 0))
t)
((looking-at "filename \\(.+\\)\n")
@@ -220,6 +222,7 @@
(unless color
(setq color git-blame-ancient-color))
(setq info (list hash src-line res-line num-lines
+ (git-describe-commit hash)
(cons 'color color))))
(puthash hash info git-blame-cache))
(goto-line res-line)
@@ -233,7 +236,8 @@
(overlay-put ovl 'git-blame info)
(overlay-put ovl 'help-echo hash)
(overlay-put ovl 'face (list :background
- (cdr (assq 'color (cddddr info)))))
+ (cdr (assq 'color (nthcdr 5 info)))))
+ ;; the point-entered property doesn't seem to work in overlays
;;(overlay-put ovl 'point-entered
;; `(lambda (x y) (git-blame-identify ,hash)))
(let ((modified (buffer-modified-p)))
@@ -253,11 +257,21 @@
(car info)
(error "No commit info"))))
+(defun git-describe-commit (hash)
+ (with-temp-buffer
+ (call-process "git" nil t nil
+ "log" "-1" "--pretty=oneline"
+ hash)
+ (buffer-substring (point-min) (1- (point-max)))))
+
+(defvar git-blame-last-identification nil)
+(make-variable-buffer-local 'git-blame-last-identification)
(defun git-blame-identify (&optional hash)
(interactive)
- (shell-command
- (format "git log -1 --pretty=oneline %s" (or hash
- (git-blame-current-commit)))))
+ (let ((info (gethash (or hash (git-blame-current-commit)) git-blame-cache)))
+ (when (and info (not (eq info git-blame-last-identification)))
+ (message "%s" (nth 4 info))
+ (setq git-blame-last-identification info))))
(provide 'git-blame)
--
1.5.0.rc3.204.g93c76
--
David Kågedal
reply other threads:[~2007-02-09 8:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87veibpwrt.fsf@morpheus.local \
--to=davidk@lysator.liu.se \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.