Subject: Re: bug#41974: 28.0.50; Some vc commands refuse to work when called on non-file buffer

From: Dmitry Gutov <[email-masked]>
Date: Sun, 21 Jun 2020 03:07:40 +0300

On 21.06.2020 02:55, Juri Linkov wrote:
> I think this restriction should be lifted, so vc commands should
> work even when called on non-file buffers whose default-directory
> is inside the vc project.

Agreed.

Does this patch help, or does it miss more cases?

diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 9b12d44978..36013fcdc9 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2563,7 +2563,7 @@ vc-print-branch-log
      (vc-read-revision "Branch to log: ")))
    (when (equal branch "")
      (error "No branch specified"))
-  (let* ((backend (vc-responsible-backend default-directory))
+  (let* ((backend (vc-deduce-backend))
           (rootdir (vc-call-backend backend 'root default-directory)))
      (vc-print-log-internal backend
                             (list rootdir) branch t