This repository was archived by the owner on Sep 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +2
-5
lines changed Expand file tree Collapse file tree 2 files changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package diff
22
33import (
44 "bytes"
5- "errors"
65 "fmt"
76 "io"
87 "strings"
@@ -45,8 +44,6 @@ const (
4544 DefaultContextLines = 3
4645)
4746
48- var ErrBothFilesEmpty = errors .New ("both files are empty" )
49-
5047// UnifiedEncoder encodes an unified diff into the provided Writer.
5148// There are some unsupported features:
5249// - Similarity index for renames
@@ -106,7 +103,7 @@ func (e *UnifiedEncoder) printMessage(message string) {
106103func (e * UnifiedEncoder ) header (from , to File , isBinary bool ) error {
107104 switch {
108105 case from == nil && to == nil :
109- return ErrBothFilesEmpty
106+ return nil
110107 case from != nil && to != nil :
111108 hashEquals := from .Hash () == to .Hash ()
112109
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ func (s *UnifiedEncoderTestSuite) TestBothFilesEmpty(c *C) {
2020 buffer := bytes .NewBuffer (nil )
2121 e := NewUnifiedEncoder (buffer , 1 )
2222 err := e .Encode (testPatch {filePatches : []testFilePatch {{}}})
23- c .Assert (err , Equals , ErrBothFilesEmpty )
23+ c .Assert (err , IsNil )
2424}
2525
2626func (s * UnifiedEncoderTestSuite ) TestBinaryFile (c * C ) {
You can’t perform that action at this time.
0 commit comments