Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to exclude certain directories? #4

Closed
pcompassion opened this issue Jan 17, 2014 · 7 comments
Closed

Is there a way to exclude certain directories? #4

pcompassion opened this issue Jan 17, 2014 · 7 comments
Assignees

Comments

@pcompassion
Copy link

I'd like to exclude certain directories when searching.

@yasuyk
Copy link
Owner

yasuyk commented Jan 18, 2014

Thank you for the suggestion. git-grep has no --exclude-dir option unlike GNU grep. However, It seems possible by executing the following commands.

git grep <pattern> -- `git ls-files | grep -v <exclude-file-name-pattern>`

I will try it. Please wait for some time.

@ghost ghost assigned yasuyk Jan 18, 2014
@yasuyk yasuyk closed this as completed Jan 23, 2014
@yasuyk
Copy link
Owner

yasuyk commented Jan 23, 2014

@pcompassion I have implemented this feature. Please try helm-git-grep-with-exclude-file-pattern command. Note that it excludes not only derectories but also files which match exclude-file-pattern.

@yasuyk
Copy link
Owner

yasuyk commented Jan 26, 2014

@pcompassion I would be happy if you could give me any feedback.

@pcompassion
Copy link
Author

wow, I wasn't expecting it to be implemented fast.
Basic functionality (excluding a pattern) seems to work.

I'm reporting errors I had

  1. if there is a non-ascii filename in the git repository
    fatal: "momsite/momsplanner/data/Data\353\ 263\204 2\354\260\250 \354\244\221\354\232\224 \354\271\264\355\205\214\352\263\240\353\246|254.docx": no such path in the working tree.
  2. if I give regex like foo_|bar_ , it fails with exit code 127
    (It's always hard for me to use the right regex syntax for emacs. How do I exclude multiple patterns?)

Thanks for the great work though!

@yasuyk
Copy link
Owner

yasuyk commented Jan 31, 2014

Thank you for your feedback!

  1. if there is a non-ascii filename in the git repository
    fatal: "momsite/momsplanner/data/Data\353\ 263\204 2\354\260\250 \354\244\221\354\232\224 \354\271\264\355\205\214\352\263\240\353\246|254.docx": no such path in the working tree.

I try this issue with Japanese filename, and can't reproduce it. Could you tell me the precise file name?

  1. if I give regex like foo_|bar_ , it fails with exit code 127
    (It's always hard for me to use the right regex syntax for emacs. How do I exclude multiple patterns?)

This issue was fixed at #5. You can use POSIX ERE like foo_|bar_ to exclude multiple patterns now.

@pcompassion
Copy link
Author

  1. Data별 2차 중요 카테고리.docx
    (korean)

foo_|bar_ works fine now

@yasuyk
Copy link
Owner

yasuyk commented Feb 5, 2014

@pcompassion Thanks!

I added Data별 2차 중요 카테고리.docx to git repository, but can't reproduce that issue. I use Emacs 24.3.50.1 on OS X 10.9. It seems that the cause is operating system encoding.

yasuyk added a commit that referenced this issue Feb 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants