@@ -10,7 +10,8 @@ import (
1010 "strings"
1111
1212 "gopkg.in/src-d/go-git.v4/plumbing"
13- "gopkg.in/src-d/go-git.v4/utils/fs"
13+
14+ "srcd.works/go-billy.v1"
1415)
1516
1617const (
@@ -51,33 +52,33 @@ var (
5152// The DotGit type represents a local git repository on disk. This
5253// type is not zero-value-safe, use the New function to initialize it.
5354type DotGit struct {
54- fs fs .Filesystem
55+ fs billy .Filesystem
5556}
5657
5758// New returns a DotGit value ready to be used. The path argument must
5859// be the absolute path of a git repository directory (e.g.
5960// "/foo/bar/.git").
60- func New (fs fs .Filesystem ) * DotGit {
61+ func New (fs billy .Filesystem ) * DotGit {
6162 return & DotGit {fs : fs }
6263}
6364
6465// ConfigWriter returns a file pointer for write to the config file
65- func (d * DotGit ) ConfigWriter () (fs .File , error ) {
66+ func (d * DotGit ) ConfigWriter () (billy .File , error ) {
6667 return d .fs .Create (configPath )
6768}
6869
6970// Config returns a file pointer for read to the config file
70- func (d * DotGit ) Config () (fs .File , error ) {
71+ func (d * DotGit ) Config () (billy .File , error ) {
7172 return d .fs .Open (configPath )
7273}
7374
7475// ShallowWriter returns a file pointer for write to the shallow file
75- func (d * DotGit ) ShallowWriter () (fs .File , error ) {
76+ func (d * DotGit ) ShallowWriter () (billy .File , error ) {
7677 return d .fs .Create (shallowPath )
7778}
7879
7980// Shallow returns a file pointer for read to the shallow file
80- func (d * DotGit ) Shallow () (fs .File , error ) {
81+ func (d * DotGit ) Shallow () (billy .File , error ) {
8182 f , err := d .fs .Open (shallowPath )
8283 if err != nil {
8384 if os .IsNotExist (err ) {
@@ -124,7 +125,7 @@ func (d *DotGit) ObjectPacks() ([]plumbing.Hash, error) {
124125}
125126
126127// ObjectPack returns a fs.File of the given packfile
127- func (d * DotGit ) ObjectPack (hash plumbing.Hash ) (fs .File , error ) {
128+ func (d * DotGit ) ObjectPack (hash plumbing.Hash ) (billy .File , error ) {
128129 file := d .fs .Join (objectsPath , packPath , fmt .Sprintf ("pack-%s.pack" , hash .String ()))
129130
130131 pack , err := d .fs .Open (file )
@@ -140,7 +141,7 @@ func (d *DotGit) ObjectPack(hash plumbing.Hash) (fs.File, error) {
140141}
141142
142143// ObjectPackIdx returns a fs.File of the index file for a given packfile
143- func (d * DotGit ) ObjectPackIdx (hash plumbing.Hash ) (fs .File , error ) {
144+ func (d * DotGit ) ObjectPackIdx (hash plumbing.Hash ) (billy .File , error ) {
144145 file := d .fs .Join (objectsPath , packPath , fmt .Sprintf ("pack-%s.idx" , hash .String ()))
145146 idx , err := d .fs .Open (file )
146147 if err != nil {
@@ -190,7 +191,7 @@ func (d *DotGit) Objects() ([]plumbing.Hash, error) {
190191}
191192
192193// Object return a fs.File poiting the object file, if exists
193- func (d * DotGit ) Object (h plumbing.Hash ) (fs .File , error ) {
194+ func (d * DotGit ) Object (h plumbing.Hash ) (billy .File , error ) {
194195 hash := h .String ()
195196 file := d .fs .Join (objectsPath , hash [0 :2 ], hash [2 :40 ])
196197
0 commit comments