emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r99881: Fix vc-annotate for rename


From: Dan Nicolaescu
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r99881: Fix vc-annotate for renamed files when using Git.
Date: Tue, 22 Jun 2010 12:25:17 -0700
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99881
committer: Dan Nicolaescu <address@hidden>
branch nick: emacs-23
timestamp: Tue 2010-06-22 12:25:17 -0700
message:
  Fix vc-annotate for renamed files when using Git.
  * lisp/vc-git.el (vc-git-find-revision): Deal with empty results from
  ls-files.  Doe not pass the object as a file name to cat-file, it
  is not a file name.
  (vc-git-annotate-command): Pass the file name using -- to avoid
  ambiguity with the revision.
  (vc-git-previous-revision): Pass a relative file name.
modified:
  lisp/ChangeLog
  lisp/vc-git.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-06-22 07:04:20 +0000
+++ b/lisp/ChangeLog    2010-06-22 19:25:17 +0000
@@ -1,3 +1,13 @@
+2010-06-22  Dan Nicolaescu  <address@hidden>
+
+       Fix vc-annotate for renamed files when using Git.
+       * vc-git.el (vc-git-find-revision): Deal with empty results from
+       ls-files.  Doe not pass the object as a file name to cat-file, it
+       is not a file name.
+       (vc-git-annotate-command): Pass the file name using -- to avoid
+       ambiguity with the revision.
+       (vc-git-previous-revision): Pass a relative file name.
+
 2010-06-22  Glenn Morris  <address@hidden>
 
        * progmodes/js.el (js-mode-map): Use standard capitalization and

=== modified file 'lisp/vc-git.el'
--- a/lisp/vc-git.el    2010-06-21 20:03:30 +0000
+++ b/lisp/vc-git.el    2010-06-22 19:25:17 +0000
@@ -551,13 +551,18 @@
   (let* (process-file-side-effects
         (coding-system-for-read 'binary)
         (coding-system-for-write 'binary)
-        (fullname (substring
-                   (vc-git--run-command-string
-                    file "ls-files" "-z" "--full-name" "--")
-                   0 -1)))
+        (fullname
+         (let ((fn (vc-git--run-command-string
+                    file "ls-files" "-z" "--full-name" "--")))
+           ;; ls-files does not return anything when looking for a
+           ;; revision of a file that has been renamed or removed.
+           (if (string= fn "")
+               (file-relative-name file (vc-git-root default-directory))
+             (substring fn 0 -1)))))
     (vc-git-command
      buffer 0
-     (concat (if rev rev "HEAD") ":" fullname) "cat-file" "blob")))
+     nil
+     "cat-file" "blob" (concat (if rev rev "HEAD") ":" fullname))))
 
 (defun vc-git-checkout (file &optional editable rev)
   (vc-git-command nil 0 file "checkout" (or rev "HEAD")))
@@ -689,7 +694,7 @@
 
 (defun vc-git-annotate-command (file buf &optional rev)
   (let ((name (file-relative-name file)))
-    (vc-git-command buf 'async name "blame" "--date=iso" "-C" "-C" rev)))
+    (vc-git-command buf 'async nil "blame" "--date=iso" "-C" "-C" rev "--" 
name)))
 
 (declare-function vc-annotate-convert-time "vc-annotate" (time))
 
@@ -735,11 +740,10 @@
 (defun vc-git-previous-revision (file rev)
   "Git-specific version of `vc-previous-revision'."
   (if file
-      (let* ((default-directory (file-name-directory (expand-file-name file)))
-             (file (file-name-nondirectory file))
+      (let* ((fname (file-relative-name file))
              (prev-rev (with-temp-buffer
                          (and
-                          (vc-git--out-ok "rev-list" "-2" rev "--" file)
+                          (vc-git--out-ok "rev-list" "-2" rev "--" fname)
                           (goto-char (point-max))
                           (bolp)
                           (zerop (forward-line -1))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]