[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master d75558f 2/2: Fix problem with non-absolute names
From: |
Lars Ingebrigtsen |
Subject: |
master d75558f 2/2: Fix problem with non-absolute names |
Date: |
Thu, 11 Nov 2021 07:20:46 -0500 (EST) |
branch: master
commit d75558f11c802dddc9b173f85b1c07aff7c9c3bd
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Fix problem with non-absolute names
* lisp/files.el (file-name-split): Fix problem with non-absolute
names.
---
lisp/files.el | 2 +-
test/lisp/files-tests.el | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lisp/files.el b/lisp/files.el
index c694df3..3490d04 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -5069,7 +5069,7 @@ On most systems, this will be true:
(setq filename (and dir (directory-file-name dir)))
;; If there's nothing left to peel off, we're at the root and
;; we can stop.
- (when (equal dir filename)
+ (when (and dir (equal dir filename))
(push "" components)
(setq filename nil))))
components))
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index 787e639..d00f1ce 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."
;; `save-some-buffers-default-predicate' (i.e. the 2nd element) is
ignored.
(nil save-some-buffers-root ,nb-might-save))))))
-(defun test-file-name-split ()
+(ert-deftest test-file-name-split ()
(should (equal (file-name-split "foo/bar") '("foo" "bar")))
(should (equal (file-name-split "/foo/bar") '("" "foo" "bar")))
(should (equal (file-name-split "/foo/bar/zot") '("" "foo" "bar" "zot")))