aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/diff/unified_encoder.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-12-07 10:44:22 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2017-12-07 10:44:22 +0100
commit89932462a587e15051040aa49d99201853726dcf (patch)
treea9dc77090090ef2a8a924bfc40e413462f3f8972 /plumbing/format/diff/unified_encoder.go
parent10f766354c4f6e759e00e6649fa3658776da70e4 (diff)
downloadgo-git-89932462a587e15051040aa49d99201853726dcf.tar.gz
format: diff, remove error when two files are empty, submodules are simply ignored
Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
Diffstat (limited to 'plumbing/format/diff/unified_encoder.go')
-rw-r--r--plumbing/format/diff/unified_encoder.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/plumbing/format/diff/unified_encoder.go b/plumbing/format/diff/unified_encoder.go
index a4ff7ab..cf2a34b 100644
--- a/plumbing/format/diff/unified_encoder.go
+++ b/plumbing/format/diff/unified_encoder.go
@@ -2,7 +2,6 @@ package diff
import (
"bytes"
- "errors"
"fmt"
"io"
"strings"
@@ -45,8 +44,6 @@ const (
DefaultContextLines = 3
)
-var ErrBothFilesEmpty = errors.New("both files are empty")
-
// UnifiedEncoder encodes an unified diff into the provided Writer.
// There are some unsupported features:
// - Similarity index for renames
@@ -106,7 +103,7 @@ func (e *UnifiedEncoder) printMessage(message string) {
func (e *UnifiedEncoder) header(from, to File, isBinary bool) error {
switch {
case from == nil && to == nil:
- return ErrBothFilesEmpty
+ return nil
case from != nil && to != nil:
hashEquals := from.Hash() == to.Hash()