summaryrefslogtreecommitdiff
path: root/fileactions.go
diff options
context:
space:
mode:
Diffstat (limited to 'fileactions.go')
-rw-r--r--fileactions.go40
1 files changed, 22 insertions, 18 deletions
diff --git a/fileactions.go b/fileactions.go
index 2d81177..d45b982 100644
--- a/fileactions.go
+++ b/fileactions.go
@@ -1,26 +1,30 @@
package libfastimport
+import (
+ "git.lukeshu.com/go/libfastimport/textproto"
+)
+
type FileAction interface {
- fiWriteFA(*FIWriter) error
+ fiWriteFA(*textproto.FIWriter) error
}
type FileModify struct {
- Mode Mode
- Path Path
+ Mode textproto.Mode
+ Path textproto.Path
DataRef string
}
-func (o FileModify) fiWriteFA(fiw *FIWriter) error {
+func (o FileModify) fiWriteFA(fiw *textproto.FIWriter) error {
return fiw.WriteLine("M", o.Mode, o.DataRef, o.Path)
}
type FileModifyInline struct {
- Mode Mode
- Path Path
+ Mode textproto.Mode
+ Path textproto.Path
Data []byte
}
-func (o FileModifyInline) fiWriteFA(fiw *FIWriter) error {
+func (o FileModifyInline) fiWriteFA(fiw *textproto.FIWriter) error {
ez := &ezfiw{fiw: fiw}
ez.WriteLine("M", o.Mode, "inline", o.Path)
ez.WriteData(o.Data)
@@ -28,19 +32,19 @@ func (o FileModifyInline) fiWriteFA(fiw *FIWriter) error {
}
type FileDelete struct {
- Path Path
+ Path textproto.Path
}
-func (o FileDelete) fiWriteFA(fiw *FIWriter) error {
+func (o FileDelete) fiWriteFA(fiw *textproto.FIWriter) error {
return fiw.WriteLine("D", o.Path)
}
type FileCopy struct {
- Src Path
- Dst Path
+ Src textproto.Path
+ Dst textproto.Path
}
-func (o FileCopy) fiWriteFA(fiw *FIWriter) error {
+func (o FileCopy) fiWriteFA(fiw *textproto.FIWriter) error {
return fiw.WriteLine("C", o.Src, o.Dst)
}
@@ -49,13 +53,13 @@ type FileRename struct {
Dst string
}
-func (o FileRename) fiWriteFA(fiw *FIWriter) error {
+func (o FileRename) fiWriteFA(fiw *textproto.FIWriter) error {
return fiw.WriteLine("R", o.Src, o.Dst)
}
type FileDeleteAll struct{}
-func (o FileDeleteAll) fiWriteFA(fiw *FIWriter) error {
+func (o FileDeleteAll) fiWriteFA(fiw *textproto.FIWriter) error {
return fiw.WriteLine("deleteall")
}
@@ -64,7 +68,7 @@ type NoteModify struct {
DataRef string
}
-func (o NoteModify) fiWriteFA(fiw *FIWriter) error {
+func (o NoteModify) fiWriteFA(fiw *textproto.FIWriter) error {
return fiw.WriteLine("N", o.DataRef, o.CommitIsh)
}
@@ -73,7 +77,7 @@ type NoteModifyInline struct {
Data []byte
}
-func (o NoteModifyInline) fiWriteFA(fiw *FIWriter) error {
+func (o NoteModifyInline) fiWriteFA(fiw *textproto.FIWriter) error {
ez := &ezfiw{fiw: fiw}
ez.WriteLine("N", "inline", o.CommitIsh)
ez.WriteData(o.Data)
@@ -82,9 +86,9 @@ func (o NoteModifyInline) fiWriteFA(fiw *FIWriter) error {
// See CmdLs for using ls outside of a commit
type FileLs struct {
- Path Path
+ Path textproto.Path
}
-func (o FileLs) fiWriteFA(fiw *FIWriter) error {
+func (o FileLs) fiWriteFA(fiw *textproto.FIWriter) error {
return fiw.WriteLine("ls", o.Path)
}