1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
type FileAction interface {
fiWrite(fi *FastImport) error
}
type FileModify struct {
Mode FileMode
Path string
DataRef string
}
func (o FileModify) fiWrite(fi *FastImport) error {
return fi.printf(w, "M %06o %s %s\n", o.Mode, o.DataRef, pathEscape(o.Path))
}
type FileModifyInline struct {
Mode FileMode
Path string
Data []byte
}
func (o FileModifyInline) fiWrite(fi *FastImport) error {
fi.printf("M %06o inline %s\n", o.Mode, pathEscape(o.Path))
return fi.data(o.Data)
}
type FileDelete struct {
Path string
}
func (o FileDelete) fiWrite(fi *FastImport) error {
return fi.printf("D %s\n", pathEscape(o.Path))
}
type FileCopy struct {
Src string
Dst string
}
func (o FileCopy) fiWrite(fi *FastImport) error {
return fi.printf("C %s %s\n", pathEscape(o.Src), pathEscape(o.Dst))
}
type FileRename struct {
Src string
Dst string
}
func (o FileRename) fiWrite(fi *FastImport) error {
return fi.printf("R %s %s\n", pathEscape(o.Src), pathEscape(o.Dst))
}
type FileDeleteAll struct{}
func (o FileDeleteAll) fiWrite(fi *FastImport) error {
return fi.printf("deleteall\n")
}
type NoteModify struct {
CommitIsh string
DataRef string
}
func (o NoteModify) fiWrite(fi *FastImport) error {
return fi.printf("N %s %s\n", o.DataRef, o.CommitIsh)
}
type NoteModifyInline struct {
CommitIsh string
Data []byte
}
func (o NoteModify) fiWrite(fi *FastImport) error {
fi.printf("N inline %s\n", o.CommitIsh)
return fi.data(o.Data)
}
|