Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage: filesystem, switch from os.SEEK_* to io.Seek* #421

Merged
merged 1 commit into from Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions storage/filesystem/dotgit/dotgit_test.go
Expand Up @@ -3,6 +3,7 @@ package dotgit
import (
"bufio"
"encoding/hex"
"io"
"io/ioutil"
"os"
"path/filepath"
Expand Down Expand Up @@ -510,13 +511,13 @@ func (s *SuiteDotGit) TestObjectPackWithKeepDescriptors(c *C) {
c.Assert(filepath.Ext(pack.Name()), Equals, ".pack")

// Move to an specific offset
pack.Seek(42, os.SEEK_SET)
pack.Seek(42, io.SeekStart)

pack2, err := dir.ObjectPack(plumbing.NewHash(f.PackfileHash))
c.Assert(err, IsNil)

// If the file is the same the offset should be the same
offset, err := pack2.Seek(0, os.SEEK_CUR)
offset, err := pack2.Seek(0, io.SeekCurrent)
c.Assert(err, IsNil)
c.Assert(offset, Equals, int64(42))

Expand All @@ -527,7 +528,7 @@ func (s *SuiteDotGit) TestObjectPackWithKeepDescriptors(c *C) {
c.Assert(err, IsNil)

// If the file is opened again its offset should be 0
offset, err = pack2.Seek(0, os.SEEK_CUR)
offset, err = pack2.Seek(0, io.SeekCurrent)
c.Assert(err, IsNil)
c.Assert(offset, Equals, int64(0))

Expand Down
4 changes: 2 additions & 2 deletions storage/filesystem/object_test.go
Expand Up @@ -71,15 +71,15 @@ func (s *FsSuite) TestGetFromPackfileKeepDescriptors(c *C) {
pack1, err := dg.ObjectPack(packfiles[0])
c.Assert(err, IsNil)

pack1.Seek(42, os.SEEK_SET)
pack1.Seek(42, io.SeekStart)

err = o.Close()
c.Assert(err, IsNil)

pack2, err := dg.ObjectPack(packfiles[0])
c.Assert(err, IsNil)

offset, err := pack2.Seek(0, os.SEEK_CUR)
offset, err := pack2.Seek(0, io.SeekCurrent)
c.Assert(err, IsNil)
c.Assert(offset, Equals, int64(0))

Expand Down