Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit fa697fa

Browse files
committed
plumbing: packfile, rename DiskObject to FSObject
Signed-off-by: Miguel Molina <[email protected]>
1 parent 34cc506 commit fa697fa

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

plumbing/format/packfile/disk_object.go renamed to plumbing/format/packfile/fsobject.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"gopkg.in/src-d/go-git.v4/plumbing"
77
)
88

9-
// DiskObject is an object from the packfile on disk.
10-
type DiskObject struct {
9+
// FSObject is an object from the packfile on disk.
10+
type FSObject struct {
1111
hash plumbing.Hash
1212
h *ObjectHeader
1313
offset int64
@@ -16,15 +16,15 @@ type DiskObject struct {
1616
packfile *Packfile
1717
}
1818

19-
// NewDiskObject creates a new disk object.
20-
func NewDiskObject(
19+
// NewFSObject creates a new disk object.
20+
func NewFSObject(
2121
hash plumbing.Hash,
2222
finalType plumbing.ObjectType,
2323
offset int64,
2424
contentSize int64,
2525
packfile *Packfile,
26-
) *DiskObject {
27-
return &DiskObject{
26+
) *FSObject {
27+
return &FSObject{
2828
hash: hash,
2929
offset: offset,
3030
size: contentSize,
@@ -34,31 +34,31 @@ func NewDiskObject(
3434
}
3535

3636
// Reader implements the plumbing.EncodedObject interface.
37-
func (o *DiskObject) Reader() (io.ReadCloser, error) {
37+
func (o *FSObject) Reader() (io.ReadCloser, error) {
3838
return o.packfile.getObjectContent(o.offset)
3939
}
4040

4141
// SetSize implements the plumbing.EncodedObject interface. This method
4242
// is a noop.
43-
func (o *DiskObject) SetSize(int64) {}
43+
func (o *FSObject) SetSize(int64) {}
4444

4545
// SetType implements the plumbing.EncodedObject interface. This method is
4646
// a noop.
47-
func (o *DiskObject) SetType(plumbing.ObjectType) {}
47+
func (o *FSObject) SetType(plumbing.ObjectType) {}
4848

4949
// Hash implements the plumbing.EncodedObject interface.
50-
func (o *DiskObject) Hash() plumbing.Hash { return o.hash }
50+
func (o *FSObject) Hash() plumbing.Hash { return o.hash }
5151

5252
// Size implements the plumbing.EncodedObject interface.
53-
func (o *DiskObject) Size() int64 { return o.size }
53+
func (o *FSObject) Size() int64 { return o.size }
5454

5555
// Type implements the plumbing.EncodedObject interface.
56-
func (o *DiskObject) Type() plumbing.ObjectType {
56+
func (o *FSObject) Type() plumbing.ObjectType {
5757
return o.typ
5858
}
5959

6060
// Writer implements the plumbing.EncodedObject interface. This method always
6161
// returns a nil writer.
62-
func (o *DiskObject) Writer() (io.WriteCloser, error) {
62+
func (o *FSObject) Writer() (io.WriteCloser, error) {
6363
return nil, nil
6464
}

plumbing/format/packfile/packfile.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func (p *Packfile) nextObject() (plumbing.EncodedObject, error) {
232232

233233
p.offsetToType[h.Offset] = typ
234234

235-
return NewDiskObject(hash, typ, h.Offset, size, p), nil
235+
return NewFSObject(hash, typ, h.Offset, size, p), nil
236236
}
237237

238238
func (p *Packfile) getObjectContent(offset int64) (io.ReadCloser, error) {
@@ -410,7 +410,7 @@ func (p *Packfile) Close() error {
410410
return closer.Close()
411411
}
412412

413-
// MemoryObjectFromDisk converts a DiskObject to a MemoryObject.
413+
// MemoryObjectFromDisk converts a FSObject to a MemoryObject.
414414
func MemoryObjectFromDisk(obj plumbing.EncodedObject) (plumbing.EncodedObject, error) {
415415
o2 := new(plumbing.MemoryObject)
416416
o2.SetType(obj.Type())

0 commit comments

Comments
 (0)