You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
grepdiff: allow to search only additions/deletions #3
I see. Yes, that makes sense. Perhaps it could be --only-match=add|remove|change|all, default is 'all'.
Then --only-match=add would only match hunks that add the matching string, and likewise for --only-match=remove. Either would match for --only-match=change, and additionally --only-match=all matches context lines. Does that sound better?
Activity
twaugh commentedon Mar 6, 2015
Yes, good idea. Suggested new option: --only-changed
This would cause only matches within changed '+/-/!' lines to be counted.
Want to have a go at coding it?
KangOl commentedon Mar 6, 2015
In fact, my suggestion was about only matching addition OR deletion.
My use case is to write a git pre-commit hook that check I do not let any "debugger" keyword in my js files. But removing one should be allowed.
By the way, I can take a look at the code and provide a patch.
twaugh commentedon Mar 6, 2015
I see. Yes, that makes sense. Perhaps it could be --only-match=add|remove|change|all, default is 'all'.
Then --only-match=add would only match hunks that add the matching string, and likewise for --only-match=remove. Either would match for --only-match=change, and additionally --only-match=all matches context lines. Does that sound better?
KangOl commentedon Mar 6, 2015
That's perfect
grepdiff: add `--only-match` option
grepdiff: add `--only-match` option
grepdiff: add `--only-match` option
grepdiff: add `--only-match` option
grepdiff: add `--only-match` option