Skip to content

grepdiff: allow to search only additions/deletions #3

Closed

Description

@KangOl

It would be useful that grep only match addition or deletions.

Activity

  1. twaugh commented on Mar 6, 2015

    @twaugh
    Owner

    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?

  2. KangOl commented on Mar 6, 2015

    @KangOl
    ContributorAuthor

    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.

  3. twaugh commented on Mar 6, 2015

    @twaugh
    Owner

    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?

  4. KangOl commented on Mar 6, 2015

    @KangOl
    ContributorAuthor

    That's perfect

  5. added 4 commits that reference this issue on Mar 23, 2019
    888e9f4
    f3e56a7
    53c0fe8
    e05029f
  6. added a commit that references this issue on Jul 8, 2020
    7f4967f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions