Commit 3431e82d authored by Lars Magne Ingebrigtsen's avatar Lars Magne Ingebrigtsen
Browse files

Ignore directory symlinks in directory-files-recursively

* files.el (directory-files-recursively): Don't follow symlinks to
other directories.
parent 14efb831
2014-12-12 Lars Magne Ingebrigtsen <larsi@gnus.org>
* files.el (directory-files-recursively): Don't follow symlinks to
other directories.
2014-12-12 Eric S. Raymond <esr@snark.thyrsus.com>
* vc/vc-dav.el, vc/vc-git.el, vc/vc-hg.el, vc/vc-src.el,
......
......@@ -772,15 +772,15 @@ If INCLUDE-DIRECTORIES, also include directories that have matching names."
'string<))
(unless (member file '("./" "../"))
(if (= (aref file (1- (length file))) ?/)
(progn
(setq result (nconc result (directory-files-recursively
(expand-file-name file dir)
match include-directories)))
(let ((path (expand-file-name file dir)))
;; Don't follow symlinks to other directories.
(unless (file-symlink-p path)
(setq result (nconc result (directory-files-recursively
path match include-directories))))
(when (and include-directories
(string-match match
(substring file 0 (1- (length file)))))
(setq result (nconc result (list
(expand-file-name file dir))))))
(setq result (nconc result (list path)))))
(when (string-match match file)
(push (expand-file-name file dir) files)))))
(nconc result (nreverse files))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment