]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix minor bugs in vc-git and vc-hg on Windows uncovered by vc-tests
authorEli Zaretskii <eliz@gnu.org>
Fri, 1 Sep 2023 13:08:36 +0000 (16:08 +0300)
committerEli Zaretskii <eliz@gnu.org>
Fri, 1 Sep 2023 13:08:36 +0000 (16:08 +0300)
* lisp/vc/vc-hg.el (vc-hg-state-slow): Non-existing files emit a
different message on MS-Windows; support that.
* lisp/vc/vc-git.el (vc-git-checkin): Make sure
'default-directory' is not nil when calling
'make-nearby-temp-file' on MS-Windows.

* test/lisp/vc/vc-tests.el (vc-test--version-diff): Run
'default-directory' through 'file-truename', otherwise the
'vc-test-cvs06-version-diff' test might fail on MS-Windows.

lisp/vc/vc-git.el
lisp/vc/vc-hg.el
test/lisp/vc/vc-tests.el

index 218696c05f444fc5c00ad3aabf4f961cf375cc89..fe6215f47b8f61ee14706a0260614e6d64c755c3 100644 (file)
@@ -1014,7 +1014,8 @@ It is based on `log-edit-mode', and has Git-specific extensions."
           ;; might not support the non-ASCII characters in the log
           ;; message.  Handle also remote files.
           (if (eq system-type 'windows-nt)
-              (let ((default-directory (file-name-directory file1)))
+              (let ((default-directory (or (file-name-directory file1)
+                                           default-directory)))
                 (make-nearby-temp-file "git-msg")))))
     (when vc-git-patch-string
       (unless (zerop (vc-git-command nil t nil "diff" "--cached" "--quiet"))
index 5bab9aa529e84bd19762ba0cc20be83c05314a4a..a89e652005598d7eb639992b353bae4eafd4d264 100644 (file)
@@ -249,7 +249,10 @@ If `ask', you will be prompted for a branch type."
                     (error nil)))))))
     (when (and (eq 0 status)
               (> (length out) 0)
-              (null (string-match ".*: No such file or directory$" out)))
+                         ;; Posix
+              (null (or (string-match ".*: No such file or directory$" out)
+                         ;; MS-Windows
+                         (string-match ".*: The system cannot find the file specified$" out))))
       (let ((state (aref out 0)))
        (cond
         ((eq state ?=) 'up-to-date)
index 11c20d2783c8f768b9005659af8b992a5c85b357..0a26e25e32a914a116d3ceff98fda62d6afe299d 100644 (file)
@@ -596,8 +596,9 @@ This checks also `vc-backend' and `vc-responsible-backend'."
     (let ((vc-handled-backends `(,backend))
           (default-directory
            (file-name-as-directory
-            (expand-file-name
-             (make-temp-name "vc-test") temporary-file-directory)))
+            (file-truename
+             (expand-file-name
+              (make-temp-name "vc-test") temporary-file-directory))))
           (process-environment process-environment)
           vc-test--cleanup-hook)
       (when (eq backend 'Bzr)