GNU bug report logs - #5657
`vc-git-annotate-extract-revision-at-line' returns incorrect pathname

Previous Next

Package: emacs;

Reported by: Štěpán Němec <stepnem <at> gmail.com>

Date: Sun, 28 Feb 2010 15:00:03 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Štěpán Němec <stepnem <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: `vc-git-annotate-extract-revision-at-line' returns incorrect pathname
Date: Sun, 28 Feb 2010 15:57:58 +0100
Hello,

I spotted this when running `vc-annotate-show-diff-revision-at-line', which
called the above-mentioned fuction in this case.

Incorrect path is returned when not called from the repository root, because
the value of `default-directory' (used by `expand-file-name') will be
different (i.e. the current directory deeper in the tree, instead of the
root dir).

The patch below (based on the latest Git master) fixes it.

Regards,

 Štěpán Němec

       
--- a/lisp/vc-git.el
+++ b/lisp/vc-git.el
@@ -668,7 +668,9 @@ or BRANCH^ (where \"^\" can be repeated)."
    (when (looking-at "\\([0-9a-f^][0-9a-f]+\\) \\(\\([^(]+\\) \\)?")
      (let ((revision (match-string-no-properties 1)))
	(if (match-beginning 2)
-	  (cons revision (expand-file-name (match-string-no-properties 3)))
+	  (cons revision (expand-file-name
+                          (match-string-no-properties 3)
+                          (vc-git-root default-directory)))
	  revision)))))

;;; TAG SYSTEM





This bug report was last modified 15 years and 101 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.