Skip to content

Commit 3c15d60

Browse files
committed
Revert "feat: checkout the repository worktree with go-git instead of invoking the git command"
revert for now as the actual git command line is way more robust than go git and this new code immediately failed on the first repository i tested it on, gating it behind an option might make sense though for container applications This reverts commit e59a558.
1 parent e59a558 commit 3c15d60

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

pkg/goop/clone.go

+4-18
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"io/ioutil"
99
"net/url"
1010
"os"
11+
"os/exec"
1112
"path/filepath"
1213
"strings"
1314
"time"
@@ -16,7 +17,6 @@ import (
1617
"github.com/deletescape/goop/internal/workers"
1718
"github.com/deletescape/jobtracker"
1819
"github.com/go-git/go-billy/v5/osfs"
19-
"github.com/go-git/go-git/v5"
2020
"github.com/go-git/go-git/v5/plumbing"
2121
"github.com/go-git/go-git/v5/plumbing/cache"
2222
"github.com/go-git/go-git/v5/plumbing/format/commitgraph"
@@ -425,23 +425,9 @@ func FetchGit(baseUrl, baseDir string) error {
425425

426426
func checkout(baseDir string) error {
427427
log.Info().Str("dir", baseDir).Msg("running git checkout .")
428-
429-
log.Info().Str("dir", baseDir).Msg("opening the current repository")
430-
431-
repo, err := git.PlainOpen(baseDir)
432-
if err != nil {
433-
return err
434-
}
435-
436-
log.Info().Str("dir", baseDir).Msg("switching to repo worktree")
437-
438-
worktree, err := repo.Worktree()
439-
if err != nil {
440-
return err
441-
}
442-
443-
log.Info().Str("dir", baseDir).Msg("checking out current worktree")
444-
return worktree.Checkout(&git.CheckoutOptions{})
428+
cmd := exec.Command("git", "checkout", ".")
429+
cmd.Dir = baseDir
430+
return cmd.Run()
445431
}
446432

447433
func fetchLfs(baseDir, baseUrl string) {

0 commit comments

Comments
 (0)