Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@ func eatLines(scan *bufio.Scanner, prefix string, n int) error {
if !scan.Scan() {
return io.ErrUnexpectedEOF
}
if !bytes.HasPrefix(scan.Bytes(), bprefix) {
// diff can inject comments in lines beginning with a backslash, like when
// highlighting that the original line had no trailing newline
if bytes.HasPrefix(scan.Bytes(), []byte("\\ ")) {
i--
} else if !bytes.HasPrefix(scan.Bytes(), bprefix) {
return fmt.Errorf("line %q does not have expected prefix %q", scan.Bytes(), bprefix)
}
}
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module github.com/rogpeppe/apipe

require 9fans.net/go v0.0.0-20180727211846-5d4fa602e1e8

go 1.13