{"action":"created","issue":{"url":"https://api.github.com/repos/ggreer/the_silver_searcher/issues/285","labels_url":"https://api.github.com/repos/ggreer/the_silver_searcher/issues/285/labels{/name}","comments_url":"https://api.github.com/repos/ggreer/the_silver_searcher/issues/285/comments","events_url":"https://api.github.com/repos/ggreer/the_silver_searcher/issues/285/events","html_url":"https://github.com/ggreer/the_silver_searcher/issues/285","id":21695108,"number":285,"title":"Doesn't respect \"match-beginning\" gitignore patterns in subdirs","user":{"login":"purcell","id":5636,"avatar_url":"https://avatars.githubusercontent.com/u/5636?v=3","gravatar_id":"","url":"https://api.github.com/users/purcell","html_url":"https://github.com/purcell","followers_url":"https://api.github.com/users/purcell/followers","following_url":"https://api.github.com/users/purcell/following{/other_user}","gists_url":"https://api.github.com/users/purcell/gists{/gist_id}","starred_url":"https://api.github.com/users/purcell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purcell/subscriptions","organizations_url":"https://api.github.com/users/purcell/orgs","repos_url":"https://api.github.com/users/purcell/repos","events_url":"https://api.github.com/users/purcell/events{/privacy}","received_events_url":"https://api.github.com/users/purcell/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ggreer/the_silver_searcher/labels/ignore","name":"ignore","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":29,"created_at":"2013-10-28T15:06:26Z","updated_at":"2015-08-14T18:42:36Z","closed_at":null,"body":"In `.gitignore` files, ignore patterns can be prefixed with a \"/\". `man gitignore` says:\r\n\r\n```\r\nA leading slash matches the beginning of the pathname. For example, \"/*.c\" matches \"cat-file.c\"\r\nbut not \"mozilla-sha1/sha1.c\".\r\n```\r\n\r\n`ag` currently doesn't apply such patterns when they match files in subdirectories. Steps to reproduce:\r\n\r\n```\r\n% mkdir ag-test                                                                                            % cd ag-test                                                                                               % mkdir ignored\r\n% echo 'hello' > ignored/a\r\n% echo 'hello' > b\r\n% ag hello\r\nb\r\n1:hello\r\n\r\nignored/a\r\n1:hello\r\n% echo '/ignored/*' > .gitignore  ## should ignore \"a\", but doesn't\r\n% ag hello\r\nb\r\n1:hello\r\n\r\nignored/a\r\n1:hello\r\n% echo 'ignored/*' > .gitignore\r\n% ag hello\r\nb\r\n1:hello\r\n```\r\n\r\nHowever, the non-subdir case currently works correctly:\r\n\r\n```\r\n% echo '/b' > .gitignore\r\n% ag hello\r\nignored/a\r\n1:hello\r\n```\r\n\r\nOther than this minor hiccup, it's awesomeness all the way. :-)"},"comment":{"url":"https://api.github.com/repos/ggreer/the_silver_searcher/issues/comments/131206284","html_url":"https://github.com/ggreer/the_silver_searcher/issues/285#issuecomment-131206284","issue_url":"https://api.github.com/repos/ggreer/the_silver_searcher/issues/285","id":131206284,"user":{"login":"bdesham","id":354230,"avatar_url":"https://avatars.githubusercontent.com/u/354230?v=3","gravatar_id":"","url":"https://api.github.com/users/bdesham","html_url":"https://github.com/bdesham","followers_url":"https://api.github.com/users/bdesham/followers","following_url":"https://api.github.com/users/bdesham/following{/other_user}","gists_url":"https://api.github.com/users/bdesham/gists{/gist_id}","starred_url":"https://api.github.com/users/bdesham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdesham/subscriptions","organizations_url":"https://api.github.com/users/bdesham/orgs","repos_url":"https://api.github.com/users/bdesham/repos","events_url":"https://api.github.com/users/bdesham/events{/privacy}","received_events_url":"https://api.github.com/users/bdesham/received_events","type":"User","site_admin":false},"created_at":"2015-08-14T18:42:35Z","updated_at":"2015-08-14T18:42:35Z","body":"@ctrueden After reading through this thread again, I guess you’re right. PR #284 fixed this but @mcphail closed it because it went so long without being merged :neutral_face:"}}