{"thread":{"id":"6746","subject":"[PATCH 3/7] Handle uncommitted changes and cache descriptions","startedAt":"2007-02-09T08:20:38Z","lastAt":"2007-02-09T08:20:38Z","messageCount":1,"participants":["David Kågedal"],"isPatch":true,"patchVersion":1,"patchTotal":7},"messages":[{"id":"34041","messageId":"87veibpwrt.fsf@morpheus.local","threadId":"6746","inReplyTo":null,"subject":"[PATCH 3/7] Handle uncommitted changes and cache descriptions","fromName":"David Kågedal","fromEmail":"davidk@lysator.liu.se","sentAt":"2007-02-09T08:20:38Z","receivedAt":"2007-02-09T08:20:38Z","isPatch":true,"sender":{"key":"davidk@lysator.liu.se","avatar":"https://avatars.githubusercontent.com/u/60530?v=4"},"body":"\nSigned-off-by: David Kågedal <davidk@lysator.liu.se>\n---\n contrib/emacs/git-blame.el |   26 ++++++++++++++++++++------\n 1 files changed, 20 insertions(+), 6 deletions(-)\n\ndiff --git a/contrib/emacs/git-blame.el b/contrib/emacs/git-blame.el\nindex 56a548b..c99437e 100644\n--- a/contrib/emacs/git-blame.el\n+++ b/contrib/emacs/git-blame.el\n@@ -187,8 +187,10 @@\n                (res-line (string-to-number (match-string 3)))\n                (num-lines (string-to-number (match-string 4))))\n            (setq git-blame-current\n-                 (git-blame-new-commit\n-                  hash src-line res-line num-lines)))\n+                 (if (string= hash \"0000000000000000000000000000000000000000\")\n+                     nil\n+                   (git-blame-new-commit\n+                    hash src-line res-line num-lines))))\n          (delete-region (point) (match-end 0))\n          t)\n         ((looking-at \"filename \\\\(.+\\\\)\\n\")\n@@ -220,6 +222,7 @@\n           (unless color\n             (setq color git-blame-ancient-color))\n           (setq info (list hash src-line res-line num-lines\n+                           (git-describe-commit hash)\n                            (cons 'color color))))\n         (puthash hash info git-blame-cache))\n       (goto-line res-line)\n@@ -233,7 +236,8 @@\n             (overlay-put ovl 'git-blame info)\n             (overlay-put ovl 'help-echo hash)\n             (overlay-put ovl 'face (list :background\n-                                         (cdr (assq 'color (cddddr info)))))\n+                                         (cdr (assq 'color (nthcdr 5 info)))))\n+            ;; the point-entered property doesn't seem to work in overlays\n             ;;(overlay-put ovl 'point-entered\n             ;;             `(lambda (x y) (git-blame-identify ,hash)))\n             (let ((modified (buffer-modified-p)))\n@@ -253,11 +257,21 @@\n         (car info)\n       (error \"No commit info\"))))\n \n+(defun git-describe-commit (hash)\n+  (with-temp-buffer\n+    (call-process \"git\" nil t nil\n+                  \"log\" \"-1\" \"--pretty=oneline\"\n+                  hash)\n+    (buffer-substring (point-min) (1- (point-max)))))\n+\n+(defvar git-blame-last-identification nil)\n+(make-variable-buffer-local 'git-blame-last-identification)\n (defun git-blame-identify (&optional hash)\n   (interactive)\n-  (shell-command\n-   (format \"git log -1 --pretty=oneline %s\" (or hash\n-                                                (git-blame-current-commit)))))\n+  (let ((info (gethash (or hash (git-blame-current-commit)) git-blame-cache)))\n+    (when (and info (not (eq info git-blame-last-identification)))\n+      (message \"%s\" (nth 4 info))\n+      (setq git-blame-last-identification info))))\n \n (provide 'git-blame)\n \n-- \n1.5.0.rc3.204.g93c76\n\n\n-- \nDavid Kågedal\n"}]}