gitutil: migrate to BuildKit GitCLI API

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2026-04-09 14:57:38 +02:00
parent 3124b3c839
commit 720f91fdd4
10 changed files with 135 additions and 157 deletions
+3 -2
View File
@@ -20,6 +20,7 @@ import (
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/formatter"
"github.com/docker/go-units"
bkgitutil "github.com/moby/buildkit/util/gitutil"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -59,14 +60,14 @@ func runLs(ctx context.Context, dockerCli command.Cli, opts lsOptions) error {
if err != nil {
return err
}
gitc, err := gitutil.New(gitutil.WithContext(ctx), gitutil.WithWorkingDir(wd))
gitc, err := gitutil.New(bkgitutil.WithDir(wd))
if err != nil {
if st, err1 := os.Stat(path.Join(wd, ".git")); err1 == nil && st.IsDir() {
return errors.Wrap(err, "git was not found in the system")
}
return errors.Wrapf(err, "could not find git repository for local filter")
}
remote, err := gitc.RemoteURL()
remote, err := gitc.RemoteURL(ctx)
if err != nil {
return errors.Wrapf(err, "could not get remote URL for local filter")
}