GNU bug report logs -
#78900
31.0.50; [PATCH] Use short revisions by default in some more places in VC Annotate
Previous Next
To reply to this bug, email your comments to 78900 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78900
; Package
emacs
.
(Thu, 26 Jun 2025 03:04:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Jim Porter <jporterbugs <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 26 Jun 2025 03:04:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
In bug#67062, I added support for using short revision identifiers in VC
Annotate (which is also the default behavior). This is mainly because
Git SHAs are very long, which previously made the buffer name in VC
Annotate long as well.
Unfortunately, I missed two VC Git functions that should handle short
revisions. Attached is a patch to fix this. Now, when navigating to
other revisions (e.g. by pressing "a"), we'll use short revisions by
default.
As before, you can disable this by setting
'vc-annotate-use-short-revision' to nil.
[0001-Use-short-revisions-by-default-when-navigating-to-re.patch (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78900
; Package
emacs
.
(Thu, 26 Jun 2025 15:16:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 78900 <at> debbugs.gnu.org (full text, mbox):
Hello,
On Wed 25 Jun 2025 at 08:03pm -07, Jim Porter wrote:
> @@ -650,10 +652,12 @@ vc-annotate-warp-revision
> ((and (integerp revspec) (> revspec 0))
> (setq newrev vc-buffer-revision)
> (while (and (> revspec 0) newrev)
> - (setq newrev (vc-call-backend vc-annotate-backend 'next-revision
> - (or file
> - (caadr vc-buffer-overriding-fileset))
> - newrev))
> + (setq newrev
> + (let ((vc-use-short-revision vc-annotate-use-short-revision))
> + (vc-call-backend vc-annotate-backend 'next-revision
> + (or file
> + (caadr vc-buffer-overriding-fileset))
> + newrev)))
> (setq revspec (1- revspec)))
> (unless newrev
> (message "Cannot increment %d revisions from revision %s"
Seems like here, and in the next hunk, you could hoist the let out of
the loop body and around the whole loop.
> diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
> index 67375255f19..7ebbd6951cc 100644
> --- a/lisp/vc/vc-git.el
> +++ b/lisp/vc/vc-git.el
> @@ -1934,7 +1934,10 @@ vc-git-previous-revision
> (let* ((fname (file-relative-name file))
> (prev-rev (with-temp-buffer
> (and
> - (vc-git--out-ok "rev-list" "-2" rev "--" fname)
> + (apply #'vc-git--out-ok "rev-list"
> + (append (when vc-use-short-revision
> + '("--abbrev-commit"))
> + (list "-2" rev "--" fname)))
> (goto-char (point-max))
> (bolp)
> (zerop (forward-line -1))
If you want to use 'append' then please use 'and' instead of 'when'.
But I'd suggest avoiding 'append' like this:
(vc-git--out-ok "rev-list"
(if vc-use-short-revision
"--abbrev-commit"
"--no-abbrev-commit")
"-2" rev "--" fname)
You could factor out (defun vc-git--maybe-abbrev ())
--
Sean Whitton
This bug report was last modified today.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.