[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
vc-git-show-log-entry
From: |
Karl Chen |
Subject: |
vc-git-show-log-entry |
Date: |
Mon, 20 Oct 2008 02:36:58 -0700 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) |
Hi,
In Emacs 22.2.1, visiting a git-versioned file, when I do
`vc-print-log', point always moves to the end of the buffer
instead of the beginning. This worked for me:
(defun vc-git-rev-parse (commit)
"Translate COMMIT string into full SHA1 object name.
Returns nil if not possible."
(and commit
(with-temp-buffer
(and
(zerop
(call-process "git" nil '(t nil) nil "rev-parse"
"--verify"
commit))
(goto-char (point-min))
(= (forward-line 2) 1)
(bolp)
(buffer-substring-no-properties (point-min) (1- (point-max)))))))
(defun vc-git-show-log-entry (rev)
(log-view-goto-rev (vc-git-rev-parse rev)))
I looked at CVS HEAD and noticed a new vc-git-show-log-entry and
some recent modifications. I believe the vc-git.el:1.72 version
would do the right thing for my use case, but I suspect the r1.73
change:
* vc-git.el (vc-git-show-log-entry): Include the revision in
the search string.
breaks it. It looks like that function was supposed to parse
things like "HEAD~5", "HEAD^^" into a search repeat count, but the
1.73 change changed the intention of the search.
Personally, I like the vc-git-rev-parse solution better. It
handles every method of specifying commits, the "git way".
vc-git-rev-parse can be refactored with vc-git-symbolic-commit, on
which it's based.
Karl
- vc-git-show-log-entry,
Karl Chen <=