Filtering a diff with a regular expression

前端 未结 7 1167
逝去的感伤
逝去的感伤 2020-12-01 21:30

It seems that it would be extremely handy to be able to filter a diff so that trivial changes are not displayed. I would like to write a regular expression which would be ru

相关标签:
7条回答
  • 2020-12-01 22:13

    I use an approach that combines git diff and applying a regular expression matching on the results. In some testing code (PERL), I know that testing is successful when the OutputFingerprint stored in the resulting files of the tests has not changed.

    First, I do a

    my $matches = `git diff -- mytestfile`
    

    and then evaluate the result:

    if($matches =~ /OutputFingerprint/){
      fail();
      return 1;
    }else{
      ok();
      return 0;
    }
    
    0 讨论(0)
提交回复
热议问题