package clientcmd

import (
	"fmt"

	clientconfig "github.com/deranjer/gvc/client/clientconfig"
	"github.com/deranjer/gvc/common/engine"
)

// Commit commits the tracked files and changes to the repo
func Commit(conf *clientconfig.Gvcconfig, commitMessage string, m *engine.Manager) error {
	err := m.BeginCommit(conf.CurrentBranch, commitMessage)
	if err != nil {
		return fmt.Errorf("begin commit failed with message: %s", err)
	}

	return nil
}
