unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* vc-git-show-log-entry
@ 2008-10-20  9:36 Karl Chen
  2008-10-20 15:01 ` vc-git-show-log-entry Eric Hanchrow
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Karl Chen @ 2008-10-20  9:36 UTC (permalink / raw)
  To: emacs-devel


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





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-10-21 17:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-20  9:36 vc-git-show-log-entry Karl Chen
2008-10-20 15:01 ` vc-git-show-log-entry Eric Hanchrow
2008-10-20 15:09 ` vc-git-show-log-entry Eric Hanchrow
2008-10-20 18:19 ` vc-git-show-log-entry Dan Nicolaescu
2008-10-20 20:20   ` vc-git-show-log-entry Karl Chen
2008-10-20 22:10     ` vc-git-show-log-entry Dan Nicolaescu
2008-10-21  7:23       ` vc-git-show-log-entry Karl Chen
2008-10-21  8:49         ` vc-git-show-log-entry Dan Nicolaescu
2008-10-21 17:52       ` vc-git-show-log-entry Alexandre Julliard

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).