bradleyfalzon / revgrep

Filters output from static analysis tools, showing only recently changed lines of code
Apache License 2.0
103 stars 15 forks source link

Accept patches with a/ and b/ prefix #9

Closed bradleyfalzon closed 8 years ago

bradleyfalzon commented 8 years ago

We need to accept patches which have the a/ and b/ prefixes, eg:

index 0000000..2293375
--- /dev/null
+++ b/main.go

We were stripping them out before, because we could, but if you're providing a patch, you may not be able to strip them out yourself.

This should be straight forward, something like:

diff --git a/revgrep.go b/revgrep.go
index 19e111f..61e3fe3 100644
--- a/revgrep.go
+++ b/revgrep.go
@@ -160,7 +160,7 @@ func (c Checker) linesChanged() map[string][]uint64 {
                                // record the last state
                                changes[s.file] = s.changes
                        }
-                       s = state{file: line[4:]}
+                       s = state{file: line[6:]}
                case strings.HasPrefix(line, "@@ "):
                        //      @@ -1 +2,4 @@
                        // chdr ^^^^^^^^^^^^^