AppRunner: Create .git directory when cloning repository
Change-Id: I733fd2aad5d7ec67c38cb773097b12b86ed69755
diff --git a/apps/app-runner/main.go b/apps/app-runner/main.go
index ebd0ef8..0449ca5 100644
--- a/apps/app-runner/main.go
+++ b/apps/app-runner/main.go
@@ -7,6 +7,7 @@
"log"
"net"
"os"
+ "path/filepath"
"strings"
"golang.org/x/crypto/ssh"
@@ -14,8 +15,9 @@
"github.com/go-git/go-billy/v5/osfs"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
+ "github.com/go-git/go-git/v5/plumbing/cache"
gitssh "github.com/go-git/go-git/v5/plumbing/transport/ssh"
- "github.com/go-git/go-git/v5/storage/memory"
+ "github.com/go-git/go-git/v5/storage/filesystem"
)
var port = flag.Int("port", 3000, "Port to listen on")
@@ -65,7 +67,14 @@
},
}
}
- repo, err := git.Clone(memory.NewStorage(), osfs.New(path, osfs.WithBoundOS()), opts)
+ repo, err := git.Clone(
+ filesystem.NewStorage(
+ osfs.New(filepath.Join(path, ".git"), osfs.WithBoundOS()),
+ cache.NewObjectLRUDefault(),
+ ),
+ osfs.New(path, osfs.WithBoundOS()),
+ opts,
+ )
if err != nil {
return nil, err
}