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

grepdiff: invert match #36

Open
camsteffen opened this issue Dec 5, 2019 · 3 comments
Open

grepdiff: invert match #36

camsteffen opened this issue Dec 5, 2019 · 3 comments

Comments

@camsteffen
Copy link

There should be a flag like -v, --invert-match in grep.

See https://stackoverflow.com/questions/57628550/grepdiff-find-hunks-that-dont-match-a-given-regexp (someone else's question).

My use case is to "unstage hunks that do not match" in git:

git diff --staged -U1 | grepdiff foo --invert-match --output-matching=hunk | git apply --cached -R
@twaugh
Copy link
Owner

twaugh commented Dec 6, 2019

--invert-match sounds like the right parameter name for this. Probably needs an invert_regexecs() similar to match regexecs(), and a way of switching between them appropriately (maybe a function pointer).

I don't have time to code this myself right now. Want to have a go at it?

@camsteffen
Copy link
Author

Thanks for your response. I'm also a little too busy to claim this right now.

@jansmets
Copy link

Would be useful indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants