summaryrefslogtreecommitdiff
path: root/backend.go
diff options
context:
space:
mode:
Diffstat (limited to 'backend.go')
-rw-r--r--backend.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/backend.go b/backend.go
index 0a95547..0486e98 100644
--- a/backend.go
+++ b/backend.go
@@ -17,10 +17,10 @@ package libfastimport
import (
"bufio"
- "fmt"
"io"
"git.lukeshu.com/go/libfastimport/textproto"
+ "github.com/pkg/errors"
)
// A Backend is something that consumes a fast-import stream; the
@@ -85,7 +85,7 @@ func NewBackend(fastImport io.WriteCloser, catBlob io.Reader, onErr func(error)
// It is an error (panic) if Cmd is a type that may only be used in a
// commit but we aren't in a commit.
func (b *Backend) Do(cmd Cmd) error {
- if b.err == nil {
+ if b.err != nil {
return b.err
}
@@ -94,12 +94,12 @@ func (b *Backend) Do(cmd Cmd) error {
_, b.inCommit = cmd.(CmdCommit)
case cmdClassCommit:
if !b.inCommit {
- panic(fmt.Errorf("Cannot issue commit sub-command outside of a commit: %[1]T(%#[1]v)", cmd))
+ panic(errors.Errorf("Cannot issue commit sub-command outside of a commit: %[1]T(%#[1]v)", cmd))
}
case cmdClassComment:
/* do nothing */
default:
- panic(fmt.Errorf("invalid cmdClass: %d", cmd.fiCmdClass()))
+ panic(errors.Errorf("invalid cmdClass: %d", cmd.fiCmdClass()))
}
err := cmd.fiCmdWrite(b.fastImportWrite)
@@ -167,7 +167,7 @@ func (b *Backend) CatBlob(cmd CmdCatBlob) (sha1 string, data string, err error)
//
// It is an error (panic) to call Ls if NewBackend did not have a
// cat-blob reader passed to it.
-func (b *Backend) Ls(cmd CmdLs) (mode textproto.Mode, dataref string, path textproto.Path, err error) {
+func (b *Backend) Ls(cmd CmdLs) (mode Mode, dataref string, path Path, err error) {
err = b.Do(cmd)
if err != nil {
return