all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andrii Kolomoiets <andreyk.mad@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 43464@debbugs.gnu.org
Subject: bug#43464: 28.0.50; vc: Error calling vc-revert for repo root
Date: Wed, 30 Sep 2020 12:13:41 +0300	[thread overview]
Message-ID: <m2y2krd3ui.fsf@gmail.com> (raw)
In-Reply-To: <m28sczwsqe.fsf@gmail.com> (Andrii Kolomoiets's message of "Thu,  24 Sep 2020 10:15:21 +0300")

[-- Attachment #1: Type: text/plain, Size: 378 bytes --]

Andrii Kolomoiets <andreyk.mad@gmail.com> writes:

> Dmitry Gutov <dgutov@yandex.ru> writes:
>> Could you explain both changes in that patch?
>
> The idea is to make the 'vc-backend' function to return backend for
> directory.
>
> `vc-backend` should return correct backend for directory and the
> behavior of `vc-registered` must be kept unchanged.

Please see attached patch.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-vc-backend-for-directory.patch --]
[-- Type: text/x-patch, Size: 1865 bytes --]

From 8b097942a3fbaf5b6d27fa61b2d3e5357d79beb8 Mon Sep 17 00:00:00 2001
From: Andrii Kolomoiets <andreyk.mad@gmail.com>
Date: Wed, 30 Sep 2020 12:02:21 +0300
Subject: [PATCH] vc-backend for directory

* lisp/vc/vc-hooks.el (vc-registered): Use 'responsible-p' vc backend function
to find backend for directories.
(vc-backend): Don't depend on 'vc-registered' result because it nil for
directories; always read 'vc-backend' property.
---
 lisp/vc/vc-hooks.el | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index f09ceddcb3..b20e2e0b00 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -336,12 +336,15 @@ vc-registered
       ;; There is no file name handler.
       ;; Try vc-BACKEND-registered for each handled BACKEND.
       (catch 'found
-	(let ((backend (vc-file-getprop file 'vc-backend)))
+	(let ((backend (vc-file-getprop file 'vc-backend))
+              (fn-result (if (file-directory-p file)
+                             '(responsible-p)
+                           '(registered . t))))
 	  (mapc
 	   (lambda (b)
-	     (and (vc-call-backend b 'registered file)
+	     (and (vc-call-backend b (car fn-result) file)
 		  (vc-file-setprop file 'vc-backend b)
-		  (throw 'found t)))
+		  (throw 'found (cdr fn-result))))
 	   (if (or (not backend) (eq backend 'none))
 	       vc-handled-backends
 	     (cons backend vc-handled-backends))))
@@ -361,9 +364,8 @@ vc-backend
 	   (cond ((eq property 'none) nil)
 		 (property)
 		 ;; vc-registered sets the vc-backend property
-		 (t (if (vc-registered file-or-list)
-			(vc-file-getprop file-or-list 'vc-backend)
-		      nil)))))
+		 (t (vc-registered file-or-list)
+		    (vc-file-getprop file-or-list 'vc-backend)))))
 	((and file-or-list (listp file-or-list))
 	 (vc-backend (car file-or-list)))
 	(t
-- 
2.15.1


  reply	other threads:[~2020-09-30  9:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17  7:29 bug#43464: 28.0.50; vc: Error calling vc-revert for repo root Andrii Kolomoiets
2020-09-17 16:10 ` Lars Ingebrigtsen
2020-09-18  9:00 ` Dmitry Gutov
2020-09-18  9:30   ` Andrii Kolomoiets
2020-09-18 13:30     ` Dmitry Gutov
2020-09-18 15:45       ` Andrii Kolomoiets
2020-09-22 19:48         ` Dmitry Gutov
2020-09-24  7:15           ` Andrii Kolomoiets
2020-09-30  9:13             ` Andrii Kolomoiets [this message]
2020-10-04 22:32             ` Dmitry Gutov
2020-10-05  6:02               ` Andrii Kolomoiets
2020-10-05 10:19                 ` Dmitry Gutov
2020-10-07 13:16                   ` Andrii Kolomoiets
2020-10-07 22:47                     ` Dmitry Gutov
2020-10-11 20:28                       ` Andrii Kolomoiets
2020-10-13 11:59                         ` Dmitry Gutov
2020-09-18 13:18   ` Lars Ingebrigtsen

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=m2y2krd3ui.fsf@gmail.com \
    --to=andreyk.mad@gmail.com \
    --cc=43464@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /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.