aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-11-11 13:20:34 +0100
committerLars Ingebrigtsen2021-11-11 13:20:38 +0100
commitd75558f11c802dddc9b173f85b1c07aff7c9c3bd (patch)
tree4452be889165910039081641cd2c88a6b5e70d5c
parentbf9364a56e618277fe72c90b3a741ade8bc0d205 (diff)
downloademacs-d75558f11c802dddc9b173f85b1c07aff7c9c3bd.tar.gz
emacs-d75558f11c802dddc9b173f85b1c07aff7c9c3bd.zip
Fix problem with non-absolute names
* lisp/files.el (file-name-split): Fix problem with non-absolute names.
-rw-r--r--lisp/files.el2
-rw-r--r--test/lisp/files-tests.el2
2 files changed, 2 insertions, 2 deletions
diff --git a/lisp/files.el b/lisp/files.el
index c694df38268..3490d0428a0 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -5069,7 +5069,7 @@ On most systems, this will be true:
5069 (setq filename (and dir (directory-file-name dir))) 5069 (setq filename (and dir (directory-file-name dir)))
5070 ;; If there's nothing left to peel off, we're at the root and 5070 ;; If there's nothing left to peel off, we're at the root and
5071 ;; we can stop. 5071 ;; we can stop.
5072 (when (equal dir filename) 5072 (when (and dir (equal dir filename))
5073 (push "" components) 5073 (push "" components)
5074 (setq filename nil)))) 5074 (setq filename nil))))
5075 components)) 5075 components))
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index 787e6390a6e..d00f1ce3263 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -1806,7 +1806,7 @@ Prompt users for any modified buffer with `buffer-offer-save' non-nil."
1806 ;; `save-some-buffers-default-predicate' (i.e. the 2nd element) is ignored. 1806 ;; `save-some-buffers-default-predicate' (i.e. the 2nd element) is ignored.
1807 (nil save-some-buffers-root ,nb-might-save)))))) 1807 (nil save-some-buffers-root ,nb-might-save))))))
1808 1808
1809(defun test-file-name-split () 1809(ert-deftest test-file-name-split ()
1810 (should (equal (file-name-split "foo/bar") '("foo" "bar"))) 1810 (should (equal (file-name-split "foo/bar") '("foo" "bar")))
1811 (should (equal (file-name-split "/foo/bar") '("" "foo" "bar"))) 1811 (should (equal (file-name-split "/foo/bar") '("" "foo" "bar")))
1812 (should (equal (file-name-split "/foo/bar/zot") '("" "foo" "bar" "zot"))) 1812 (should (equal (file-name-split "/foo/bar/zot") '("" "foo" "bar" "zot")))