Skip to content

Commit

Permalink
fix: increase clone timeout, fix some lint issues
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <[email protected]>
  • Loading branch information
caarlos0 authored and aymanbagabas committed May 9, 2023
1 parent 44f52c1 commit 3cf9b6b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
12 changes: 1 addition & 11 deletions git/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@ func Init(path string, bare bool) (*Repository, error) {
return Open(path)
}

func isInsideWorkTree(r *git.Repository) bool {
out, err := r.RevParse("--is-inside-work-tree")
return err == nil && out == "true"
}

func isInsideGitDir(r *git.Repository) bool {
out, err := r.RevParse("--is-inside-git-dir")
return err == nil && out == "true"
}

func gitDir(r *git.Repository) (string, error) {
return r.RevParse("--git-dir")
}
Expand Down Expand Up @@ -192,7 +182,7 @@ func (r *Repository) Patch(commit *Commit) (string, error) {

// CountCommits returns the number of commits in the repository.
func (r *Repository) CountCommits(ref *Reference) (int64, error) {
return r.Repository.RevListCount([]string{ref.Name().String()})
return r.RevListCount([]string{ref.Name().String()})
}

// CommitsByPage returns the commits for a given page and size.
Expand Down
12 changes: 7 additions & 5 deletions server/backend/sqlite/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"path/filepath"
"strings"
"time"

"github.com/charmbracelet/log"
"github.com/charmbracelet/soft-serve/git"
Expand All @@ -14,12 +15,12 @@ import (
"github.com/charmbracelet/soft-serve/server/hooks"
"github.com/charmbracelet/soft-serve/server/utils"
"github.com/jmoiron/sqlx"
_ "modernc.org/sqlite"
_ "modernc.org/sqlite" // sqlite driver
)

// SqliteBackend is a backend that uses a SQLite database as a Soft Serve
// backend.
type SqliteBackend struct {
type SqliteBackend struct { //nolint: revive
cfg *config.Config
ctx context.Context
dp string
Expand Down Expand Up @@ -177,9 +178,10 @@ func (d *SqliteBackend) ImportRepository(name string, remote string, opts backen
rp := filepath.Join(d.reposPath(), repo)

copts := git.CloneOptions{
Bare: true,
Mirror: opts.Mirror,
Quiet: true,
Bare: true,
Mirror: opts.Mirror,
Quiet: true,
Timeout: 15 * time.Minute,
CommandOptions: git.CommandOptions{
Envs: []string{
fmt.Sprintf(`GIT_SSH_COMMAND=ssh -o UserKnownHostsFile="%s" -o StrictHostKeyChecking=no -i "%s"`,
Expand Down

0 comments on commit 3cf9b6b

Please sign in to comment.