diff --git a/pkg/bootstrap/git/git.go b/pkg/bootstrap/git/git.go index 1a0f6d86..16552b47 100644 --- a/pkg/bootstrap/git/git.go +++ b/pkg/bootstrap/git/git.go @@ -44,6 +44,7 @@ type Git interface { Init(url, branch string) (bool, error) Clone(ctx context.Context, url, branch string, caBundle []byte) (bool, error) Write(path string, reader io.Reader) error + Add(path string) error Commit(message Commit, options ...Option) (string, error) Push(ctx context.Context, caBundle []byte) error Status() (bool, error) diff --git a/pkg/bootstrap/git/gogit/gogit.go b/pkg/bootstrap/git/gogit/gogit.go index 559633b5..1a22907b 100644 --- a/pkg/bootstrap/git/gogit/gogit.go +++ b/pkg/bootstrap/git/gogit/gogit.go @@ -89,6 +89,18 @@ func (g *GoGit) Init(url, branch string) (bool, error) { return true, nil } +func (g *GoGit) Add(path string) error { + wt, err := g.repository.Worktree() + if err != nil { + return err + } + _, err = wt.Add(path) + if err != nil { + return err + } + return nil +} + func (g *GoGit) Clone(ctx context.Context, url, branch string, caBundle []byte) (bool, error) { branchRef := plumbing.NewBranchReferenceName(branch) r, err := gogit.PlainCloneContext(ctx, g.path, false, &gogit.CloneOptions{