diff options
| author | Sean Whitton <spwhitton@spwhitton.name> | 2026-04-15 17:59:10 -0400 |
|---|---|---|
| committer | Sean Whitton <spwhitton@spwhitton.name> | 2026-04-15 17:59:10 -0400 |
| commit | 5045394694d72323a6746130e43cdcda2a293740 (patch) | |
| tree | a1adc0faf3739293090911ed2288371f5ad13d59 /test | |
| parent | 324e5b4177832ac8e7f41a95c4adfa6198feca1d (diff) | |
vc-rename-file: Fix case of directory with only untracked files
* lisp/vc/vc.el (vc-rename-file): Don't call into the backend if
moving a directory containing only untracked files.
* test/lisp/vc/vc-tests/vc-tests.el (vc-test--rename-directory):
New test for this case.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/vc/vc-tests/vc-tests.el | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/test/lisp/vc/vc-tests/vc-tests.el b/test/lisp/vc/vc-tests/vc-tests.el index 77e77ededfb..ca3b62ee9e8 100644 --- a/test/lisp/vc/vc-tests/vc-tests.el +++ b/test/lisp/vc/vc-tests/vc-tests.el @@ -651,6 +651,7 @@ This checks also `vc-backend' and `vc-responsible-backend'." (make-directory default-directory) (vc-test--create-repo-function backend) + ;; Test mix of registered and unregistered files. (let* ((tmp-dir (expand-file-name "dir1/" default-directory)) (tmp-name1 (expand-file-name "foo" tmp-dir)) (tmp-name2 (expand-file-name "bar" tmp-dir)) @@ -670,7 +671,22 @@ This checks also `vc-backend' and `vc-responsible-backend'." (should-not (file-exists-p tmp-name1)) (should-not (file-exists-p tmp-name2)) (should (file-exists-p new-name1)) - (should (file-exists-p new-name2)))) + (should (file-exists-p new-name2))) + + ;; Test only unregistered files. + (let* ((tmp-dir (expand-file-name "dir3/" default-directory)) + (tmp-name (expand-file-name "foo" tmp-dir)) + (new-dir (expand-file-name "dir4/" default-directory)) + (new-name (expand-file-name "foo" new-dir))) + (make-directory tmp-dir) + (write-region "foo" nil tmp-name nil 'nomessage) + + (vc-rename-file (directory-file-name tmp-dir) + (directory-file-name new-dir)) + (should-not (file-exists-p tmp-name)) + (should-not (file-exists-p tmp-name)) + (should (file-exists-p new-name)) + (should (file-exists-p new-name)))) ;; Save exit. (ignore-errors |
