all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Karl Chen <quarl@cs.berkeley.edu>
To: emacs-devel@gnu.org
Subject: vc-git-show-log-entry
Date: Mon, 20 Oct 2008 02:36:58 -0700	[thread overview]
Message-ID: <quack.20081020T0236.lthtzb7ip51@roar.cs.berkeley.edu> (raw)


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





             reply	other threads:[~2008-10-20  9:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-20  9:36 Karl Chen [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=quack.20081020T0236.lthtzb7ip51@roar.cs.berkeley.edu \
    --to=quarl@cs.berkeley.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.