Fix minor bugs in vc-git and vc-hg on Windows uncovered by vc-tests

* 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.
This commit is contained in:
Eli Zaretskii 2023-09-01 16:08:36 +03:00
parent 3f7598806e
commit a219ee8c31
3 changed files with 9 additions and 4 deletions

View 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 ;; might not support the non-ASCII characters in the log
;; message. Handle also remote files. ;; message. Handle also remote files.
(if (eq system-type 'windows-nt) (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"))))) (make-nearby-temp-file "git-msg")))))
(when vc-git-patch-string (when vc-git-patch-string
(unless (zerop (vc-git-command nil t nil "diff" "--cached" "--quiet")) (unless (zerop (vc-git-command nil t nil "diff" "--cached" "--quiet"))

View file

@ -249,7 +249,10 @@ If `ask', you will be prompted for a branch type."
(error nil))))))) (error nil)))))))
(when (and (eq 0 status) (when (and (eq 0 status)
(> (length out) 0) (> (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))) (let ((state (aref out 0)))
(cond (cond
((eq state ?=) 'up-to-date) ((eq state ?=) 'up-to-date)

View file

@ -596,8 +596,9 @@ This checks also `vc-backend' and `vc-responsible-backend'."
(let ((vc-handled-backends `(,backend)) (let ((vc-handled-backends `(,backend))
(default-directory (default-directory
(file-name-as-directory (file-name-as-directory
(expand-file-name (file-truename
(make-temp-name "vc-test") temporary-file-directory))) (expand-file-name
(make-temp-name "vc-test") temporary-file-directory))))
(process-environment process-environment) (process-environment process-environment)
vc-test--cleanup-hook) vc-test--cleanup-hook)
(when (eq backend 'Bzr) (when (eq backend 'Bzr)