emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master ad442b8: Make all vc-*-responsible-p functions return a string


From: Lars Ingebrigtsen
Subject: master ad442b8: Make all vc-*-responsible-p functions return a string
Date: Sat, 13 Nov 2021 20:38:59 -0500 (EST)

branch: master
commit ad442b8887eb08cf125797863bd992792cb4ac4a
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make all vc-*-responsible-p functions return a string
    
    * lisp/vc/vc-sccs.el (vc-sccs-responsible-p):
    * lisp/vc/vc-rcs.el (vc-rcs-responsible-p):
    * lisp/vc/vc-dav.el (vc-dav-responsible-p):
    * lisp/vc/vc-cvs.el (vc-cvs-responsible-p): Return a file name
    instead of t when we get a match (which is what
    vc-backend-for-registration expects) (bug#51800).
---
 lisp/vc/vc-cvs.el  |  9 +++++----
 lisp/vc/vc-dav.el  |  4 ++--
 lisp/vc/vc-rcs.el  |  9 +++++----
 lisp/vc/vc-sccs.el | 10 +++++++---
 4 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el
index 6f921ac..7062c49 100644
--- a/lisp/vc/vc-cvs.el
+++ b/lisp/vc/vc-cvs.el
@@ -309,10 +309,11 @@ to the CVS command."
 
 (defun vc-cvs-responsible-p (file)
   "Return non-nil if CVS thinks it is responsible for FILE."
-  (file-directory-p (expand-file-name "CVS"
-                                     (if (file-directory-p file)
-                                         file
-                                       (file-name-directory file)))))
+  (let ((dir (if (file-directory-p file)
+                file
+              (file-name-directory file))))
+    (and (file-directory-p (expand-file-name "CVS" dir))
+         dir)))
 
 (defun vc-cvs-could-register (file)
   "Return non-nil if FILE could be registered in CVS.
diff --git a/lisp/vc/vc-dav.el b/lisp/vc/vc-dav.el
index fe631ee..49a8af1 100644
--- a/lisp/vc/vc-dav.el
+++ b/lisp/vc/vc-dav.el
@@ -136,10 +136,10 @@ It should return a status of either 0 (no differences 
found), or
   "Find the version control state of all files in DIR in a fast way."
   )
 
-(defun vc-dav-responsible-p (_url)
+(defun vc-dav-responsible-p (url)
   "Return non-nil if DAV considers itself `responsible' for URL."
   ;; Check for DAV support on the web server.
-  t)
+  (and t url))
 
 ;;; Unimplemented functions
 ;;
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index e38469b..226e162 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -290,10 +290,11 @@ to the RCS command."
 (defun vc-rcs-responsible-p (file)
   "Return non-nil if RCS thinks it would be responsible for registering FILE."
   ;; TODO: check for all the patterns in vc-rcs-master-templates
-  (file-directory-p (expand-file-name "RCS"
-                                      (if (file-directory-p file)
-                                          file
-                                        (file-name-directory file)))))
+  (let ((dir (if (file-directory-p file)
+                file
+              (file-name-directory file))))
+    (and (file-directory-p (expand-file-name "RCS" dir))
+         dir)))
 
 (defun vc-rcs-receive-file (file rev)
   "Implementation of receive-file for RCS."
diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el
index bcbb87e..d59ccb3 100644
--- a/lisp/vc/vc-sccs.el
+++ b/lisp/vc/vc-sccs.el
@@ -214,9 +214,13 @@ to the SCCS command."
 (defun vc-sccs-responsible-p (file)
   "Return non-nil if SCCS thinks it would be responsible for registering FILE."
   ;; TODO: check for all the patterns in vc-sccs-master-templates
-  (or (file-directory-p (expand-file-name "SCCS" (file-name-directory file)))
-      (stringp (vc-sccs-search-project-dir (or (file-name-directory file) "")
-                                          (file-name-nondirectory file)))))
+  (or (and (file-directory-p
+            (expand-file-name "SCCS" (file-name-directory file)))
+           file)
+      (let ((dir (vc-sccs-search-project-dir (or (file-name-directory file) "")
+                                            (file-name-nondirectory file))))
+        (and (stringp dir)
+             dir))))
 
 (defun vc-sccs-checkin (files comment &optional rev)
   "SCCS-specific version of `vc-backend-checkin'."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]