{"action":"created","issue":{"url":"https://api.github.com/repos/isaacs/node-glob/issues/158","labels_url":"https://api.github.com/repos/isaacs/node-glob/issues/158/labels{/name}","comments_url":"https://api.github.com/repos/isaacs/node-glob/issues/158/comments","events_url":"https://api.github.com/repos/isaacs/node-glob/issues/158/events","html_url":"https://github.com/isaacs/node-glob/issues/158","id":56607708,"number":158,"title":"Trailing slash matching files as well, but only with subfolder matches","user":{"login":"meyer","id":13781,"avatar_url":"https://avatars.githubusercontent.com/u/13781?v=3","gravatar_id":"","url":"https://api.github.com/users/meyer","html_url":"https://github.com/meyer","followers_url":"https://api.github.com/users/meyer/followers","following_url":"https://api.github.com/users/meyer/following{/other_user}","gists_url":"https://api.github.com/users/meyer/gists{/gist_id}","starred_url":"https://api.github.com/users/meyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meyer/subscriptions","organizations_url":"https://api.github.com/users/meyer/orgs","repos_url":"https://api.github.com/users/meyer/repos","events_url":"https://api.github.com/users/meyer/events{/privacy}","received_events_url":"https://api.github.com/users/meyer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-05T00:03:55Z","updated_at":"2015-02-05T06:25:16Z","closed_at":null,"body":"I’ve encountered a peculiar issue and I’m not sure if it’s a bug.\r\n\r\nI’m globbing folders with subfolders using the pattern `*/*/`. I only want to match folders, so I’m using the trailing slash to exclude files (I wish there was a `onlydir` option as well as a `nodir` option). Here’s the strange thing: The subfolder pattern is matching files as well, but when I use the pattern `*/`, no files are matched. I’ve uploaded an example for your perusal.\r\n\r\nI’m not sure if this is a `node-glob` issue or a `minimatch` issue, but since I’ve encountered it while using `node-glob`, I put it here.\r\n\r\nUsing node 0.10.36 and node-glob 4.3.5. node-glob is `g` in the screenshot below.\r\n\r\n![image](https://cloud.githubusercontent.com/assets/13781/6052280/c0d5b186-ac85-11e4-9ef7-07e1373853a8.png)\r\n\r\nAt the moment I’m using a silly workaround to filter out files, but I’d rather have the glob pattern do that for me.\r\n\r\nIs this a bug or intended behaviour? I did some issue searching and #49 looks tangentially related, but that was ages ago."},"comment":{"url":"https://api.github.com/repos/isaacs/node-glob/issues/comments/73000437","html_url":"https://github.com/isaacs/node-glob/issues/158#issuecomment-73000437","issue_url":"https://api.github.com/repos/isaacs/node-glob/issues/158","id":73000437,"user":{"login":"meyer","id":13781,"avatar_url":"https://avatars.githubusercontent.com/u/13781?v=3","gravatar_id":"","url":"https://api.github.com/users/meyer","html_url":"https://github.com/meyer","followers_url":"https://api.github.com/users/meyer/followers","following_url":"https://api.github.com/users/meyer/following{/other_user}","gists_url":"https://api.github.com/users/meyer/gists{/gist_id}","starred_url":"https://api.github.com/users/meyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meyer/subscriptions","organizations_url":"https://api.github.com/users/meyer/orgs","repos_url":"https://api.github.com/users/meyer/repos","events_url":"https://api.github.com/users/meyer/events{/privacy}","received_events_url":"https://api.github.com/users/meyer/received_events","type":"User","site_admin":false},"created_at":"2015-02-05T06:25:16Z","updated_at":"2015-02-05T06:25:16Z","body":"Hmm. I’ve done some more digging. Looks like this bug has something to do with options.cwd being set, but not being equal to pwd.\r\n\r\nHere’s the test code:\r\n\r\n```coffee\r\nglob = require \"glob\"\r\nglobtions = sync: true\r\n\r\nprocess.chdir \"/Users/meyer/glob-test\"\r\nconsole.log \"PWD: #{process.cwd()}\"\r\nconsole.log \"globtions.cwd: #{globtions.cwd}\"\r\nconsole.log \"Matches:\", glob(\"*/\", globtions), \"\\n\"\r\n\r\nglobtions.cwd = \"/Users/meyer/glob-test\"\r\nconsole.log \"PWD: #{process.cwd()}\"\r\nconsole.log \"globtions.cwd: #{globtions.cwd}\"\r\nconsole.log \"Matches:\", glob(\"*/\", globtions), \"\\n\"\r\n\r\nprocess.chdir \"../\"\r\nconsole.log \"PWD: #{process.cwd()}\"\r\nconsole.log \"globtions.cwd: #{globtions.cwd}\"\r\nconsole.log \"Matches:\", glob(\"*/\", globtions), \"\\n\"\r\n```\r\n\r\nHere’s the output:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/13781/6055123/d6692726-acad-11e4-9c09-5a7244fb785e.png)\r\n\r\nContents of `~/glob-test`:\r\n\r\n```\r\n❯ ls -la ~/glob-test\r\ntotal 16\r\ndrwxr-xr-x   5 meyer  staff   170 Feb  4 20:17 .\r\ndrwxr-xr-x+ 77 meyer  staff  2618 Feb  4 22:23 ..\r\n-rw-r--r--@  1 meyer  staff  6148 Feb  4 20:17 .DS_Store\r\n-rw-r--r--   1 meyer  staff     0 Feb  4 20:14 this is a file.txt\r\ndrwxr-xr-x   2 meyer  staff    68 Feb  4 20:14 this is a folder\r\n```\r\n\r\nStill digging…"}}