Skip to content

Commit 04fb2a7

Browse files
authored
Merge pull request #15 from dpordomingo/fix-data-dir
Set the 'RootFolder' only if it contains 'data' dir
2 parents 3bc7a4c + 7ac8755 commit 04fb2a7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

fixtures.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,7 @@ func Init() error {
328328
rf := filepath.Join(
329329
src, "gopkg.in/src-d/go-git-fixtures.v3",
330330
)
331-
332-
if _, err := os.Stat(rf); err == nil {
331+
if _, err := os.Stat(filepath.Join(rf, DataFolder)); err == nil {
333332
RootFolder = rf
334333
return nil
335334
}
@@ -338,8 +337,11 @@ func Init() error {
338337
// Try the modules local cache
339338
if dir, err := os.Getwd(); err == nil {
340339
if pkg, err := build.Default.Import("gopkg.in/src-d/go-git-fixtures.v3", dir, build.FindOnly); err == nil {
341-
RootFolder = pkg.Dir
342-
return nil
340+
if _, err := os.Stat(filepath.Join(pkg.Dir, DataFolder)); err == nil {
341+
RootFolder = pkg.Dir
342+
return nil
343+
}
344+
343345
}
344346
}
345347

0 commit comments

Comments
 (0)