<html lang='en'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<title>
GitLab
</title>
</meta>
</head>
<style>
img {
max-width: 100%;
height: auto;
}
p.details {
font-style:italic;
color:#777
}
.footer p {
font-size:small;
color:#777
}
pre.commit-message {
white-space: pre-wrap;
}
.file-stats a {
text-decoration: none;
}
.file-stats .new-file {
color: #090;
}
.file-stats .deleted-file {
color: #B00;
}
</style>
<body>
<div class='content'>
<h3>
Raymond Toy pushed to branch master
at <a href="https://gitlab.common-lisp.net/cmucl/cmucl">cmucl / cmucl</a>
</h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://gitlab.common-lisp.net/cmucl/cmucl/commit/521f83921145b8547bb03d48e28aae17032d87a3">521f8392</a></strong>
<div>
<span>by Raymond Toy</span>
<i>at 2015-12-31T15:38:08Z</i>
</div>
<pre class='commit-message'>Handle search lists in pathname-match-p.
Allow search lists in pathname-match-p. For each arg, we enumerate
the possible values of the search list and try to find a match between
the path and the wild path. If there's a match, return true.
Tests added for some cases of pathname-match-p with search lists.
Fix issue #16.</pre>
</li>
<li>
<strong><a href="https://gitlab.common-lisp.net/cmucl/cmucl/commit/c7e71ee29988185f2bfe9b32628cc4c113f7764c">c7e71ee2</a></strong>
<div>
<span>by Raymond Toy</span>
<i>at 2016-01-03T18:11:53Z</i>
</div>
<pre class='commit-message'>Merge branch 'rtoy-issue-16' into 'master'
Handle search lists in pathname-match-p.
Allow search lists in pathname-match-p. For each arg, we enumerate
the possible values of the search list and try to find a match between
the path and the wild path. If there's a match, return true.
Tests added for some cases of pathname-match-p with search lists.
Fix issue #16.
See merge request !6</pre>
</li>
</ul>
<h4>2 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
src/code/pathname.lisp
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
<span class='new-file'>
+
tests/pathname.lisp
</span>
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.common-lisp.net/cmucl/cmucl/compare/f3b73541a4918c50abdc17da4164113e40fa6036...c7e71ee29988185f2bfe9b32628cc4c113f7764c#diff-0'>
<strong>
src/code/pathname.lisp
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/code/pathname.lisp
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/code/pathname.lisp
</span><span style="color: #aaaaaa">@@ -1227,18 +1227,21 @@ a host-structure or string."
</span> ;; Not path-designator because a file-stream can't have a
;; wild pathname.
(type (or string pathname) in-wildname))
<span style="color: #000000;background-color: #ffdddd">- (with-pathname (pathname in-pathname)
- (with-pathname (wildname in-wildname)
- (macrolet ((frob (field &optional (op 'components-match ))
- `(or (null (,field wildname))
- (,op (,field pathname) (,field wildname)))))
- (and (or (null (%pathname-host wildname))
- (eq (%pathname-host wildname) (%pathname-host pathname)))
- (frob %pathname-device)
- (frob %pathname-directory directory-components-match)
- (frob %pathname-name)
- (frob %pathname-type)
- (frob %pathname-version))))))
</span><span style="color: #000000;background-color: #ddffdd">+ (with-pathname (in-path in-pathname)
+ (enumerate-search-list (pathname in-path)
+ (with-pathname (in-wild in-wildname)
+ (enumerate-search-list (wildname in-wild)
+ (macrolet ((frob (field &optional (op 'components-match ))
+ `(or (null (,field wildname))
+ (,op (,field pathname) (,field wildname)))))
+ (when (and (or (null (%pathname-host wildname))
+ (eq (%pathname-host wildname) (%pathname-host pathname)))
+ (frob %pathname-device)
+ (frob %pathname-directory directory-components-match)
+ (frob %pathname-name)
+ (frob %pathname-type)
+ (frob %pathname-version))
+ (return-from pathname-match-p pathname))))))))
</span>
;;; SUBSTITUTE-INTO -- Internal
</code></pre>
<br>
</li>
<li id='diff-1'>
<a href='https://gitlab.common-lisp.net/cmucl/cmucl/compare/f3b73541a4918c50abdc17da4164113e40fa6036...c7e71ee29988185f2bfe9b32628cc4c113f7764c#diff-1'>
<strong>
tests/pathname.lisp
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- /dev/null
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/pathname.lisp
</span><span style="color: #aaaaaa">@@ -0,0 +1,43 @@
</span><span style="color: #000000;background-color: #ddffdd">+;; Tests for pathnames
+
+(defpackage :pathname-tests
+ (:use :cl :lisp-unit))
+
+(in-package "PATHNAME-TESTS")
+
+;; Define "foo:" search list. /tmp and /usr should exist on all unix
+;; systems.
+(setf (ext:search-list "foo:")
+ '(#p"/tmp/" #p"/usr/"))
+
+;; Define "bar:" search list. The second entry should match the
+;; second entry of the "foo:" search list.
+(setf (ext:search-list "bar:")
+ '(#p"/bin/" #p"/usr/"))
+
+(define-test pathname-match-p.search-lists
+ (:tag :search-list)
+ ;; Basic tests where the wild path is search-list
+
+ (assert-true (pathname-match-p "/tmp/foo.lisp" "foo:*"))
+ (assert-true (pathname-match-p "/tmp/zot/foo.lisp" "foo:**/*"))
+ (assert-true (pathname-match-p "/tmp/zot/foo.lisp" "foo:**/*.lisp"))
+ ;; These match because the second entry of the "foo:" search list is
+ ;; "/usr/".
+ (assert-true (pathname-match-p "/usr/foo.lisp" "foo:*"))
+ (assert-true (pathname-match-p "/usr/bin/foo" "foo:**/*"))
+ (assert-true (pathname-match-p "/usr/bin/foo.lisp" "foo:**/*.lisp"))
+
+ ;; This fails because "/bin/" doesn't match any path of the search
+ ;; list.
+ (assert-false (pathname-match-p "/bin/foo.lisp" "foo:*"))
+
+ ;; Basic test where the pathname is a search-list and the wild path is not.
+ (assert-true (pathname-match-p "foo:foo.lisp" "/tmp/*"))
+ (assert-true (pathname-match-p "foo:foo" "/usr/*"))
+ (assert-true (pathname-match-p "foo:zot/foo.lisp" "/usr/**/*.lisp"))
+
+ (assert-false (pathname-match-p "foo:foo" "/bin/*"))
+
+ ;; Tests where both args are search-lists.
+ (assert-true "foo:foo.lisp" "bar:*"))
</span></code></pre>
<br>
</li>
</div>
<div class='footer' style='margin-top: 10px;'>
<p>
—
<br>
<a href="https://gitlab.common-lisp.net/cmucl/cmucl/compare/f3b73541a4918c50abdc17da4164113e40fa6036...c7e71ee29988185f2bfe9b32628cc4c113f7764c">View it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.common-lisp.net.
If you'd like to receive fewer emails, you can adjust your notification settings.
</p>
</div>
</body>
</html>