emacs-31 1ac2f60b534: Fix strange logic in vc-git-incoming-revision
Sean Whitton <[email protected]> Mon, 29 Jun 2026 06:52:31 -0400 (EDT)
| Newsgroups | gmane.emacs.diffs |
|---|---|
| Message-ID | <[email protected]> |
branch: emacs-31 commit 1ac2f60b534add077c71a0f3ca7cf0e44b929d00 Author: Sean Whitton <[email protected]> Commit: Sean Whitton <[email protected]> Fix strange logic in vc-git-incoming-revision I think that I didn't fully update this function in this change: commit e915646b8944d8b611ab7094d9eb305ed162ff27 Author: Sean Whitton <[email protected]> Date: Wed Feb 18 11:35:16 2026 +0000 vc-git-pull, vc-git-incoming-revision: Use push remotes * lisp/vc/vc-git.el (vc-git-pull, vc-git-incoming-revision): Use configured push remotes. * etc/NEWS: Announce change to vc-git-pull. * lisp/vc/vc-git.el (vc-git-incoming-revision): Don't duplicate looking for a branch remote after just having called vc-git--branch-remotes (bug#81328). --- lisp/vc/vc-git.el | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 2a328f5cc9f..f336aae984d 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1911,28 +1911,18 @@ If LIMIT is a non-empty string, use it as a base revision." '("--"))))))) (defun vc-git-incoming-revision (&optional upstream-location refresh) - (let* ((remotes (and (not upstream-location) (vc-git--branch-remotes))) - (rev (or upstream-location - (cdr (assq 'push remotes)) - (cdr (assq 'upstream remotes))))) - (when (and (or refresh (null (vc-git--rev-parse rev))) - ;; If the branch has no upstream, and we weren't supplied - ;; with one, then fetching is always useless (bug#79952). - (or upstream-location - (and-let* ((branch (vc-git-working-branch))) - (with-temp-buffer - (vc-git--out-ok "config" "--get" - (format "branch.%s.remote" - branch)))))) - (vc-git-command nil 0 nil "fetch" - (and upstream-location - ;; Extract remote from "remote/branch". - (replace-regexp-in-string "/.*" "" - upstream-location)))) - (ignore-errors ; in order to return nil if no such branch - (with-output-to-string - (vc-git-command standard-output 0 nil - "log" "--max-count=1" "--pretty=format:%H" rev))))) + (let ((remotes (and (not upstream-location) (vc-git--branch-remotes)))) + (and-let* ((rev (or upstream-location + (cdr (assq 'push remotes)) + (cdr (assq 'upstream remotes))))) + (when (or refresh (null (vc-git--rev-parse rev))) + (vc-git-command nil 0 nil "fetch" + ;; Extract remote from "remote/branch". + (replace-regexp-in-string "/.*" "" rev))) + (ignore-errors ; in order to return nil if no such branch + (with-output-to-string + (vc-git-command standard-output 0 nil + "log" "--max-count=1" "--pretty=format:%H" rev)))))) (defun vc-git-log-search (buffer pattern) "Search the log of changes for PATTERN and output results into BUFFER.