forked from toolshed/abra
refactor!: simplifying publish logic
This commit is contained in:
@ -47,9 +47,9 @@ func Commit(repoPath, glob, commitMessage string, dryRun bool) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
logrus.Info("changes commited")
|
||||
logrus.Debug("git changes commited")
|
||||
} else {
|
||||
logrus.Info("dry run: no changes commited")
|
||||
logrus.Debug("dry run: no changes commited")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
// Push pushes the latest changes & optionally tags to the default remote
|
||||
func Push(repoDir string, remote string, tags bool, dryRun bool) error {
|
||||
if dryRun {
|
||||
logrus.Infof("dry run: no git changes pushed in %s", repoDir)
|
||||
logrus.Debugf("dry run: no git changes pushed in %s", repoDir)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ func Push(repoDir string, remote string, tags bool, dryRun bool) error {
|
||||
return err
|
||||
}
|
||||
|
||||
logrus.Info("git changes pushed")
|
||||
logrus.Debugf("git changes pushed")
|
||||
|
||||
if tags {
|
||||
opts.RefSpecs = append(opts.RefSpecs, config.RefSpec("+refs/tags/*:refs/tags/*"))
|
||||
@ -36,7 +36,7 @@ func Push(repoDir string, remote string, tags bool, dryRun bool) error {
|
||||
return err
|
||||
}
|
||||
|
||||
logrus.Info("git tags pushed")
|
||||
logrus.Debugf("git tags pushed")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -34,10 +34,8 @@ func GetRecipeHead(recipeName string) (*plumbing.Reference, error) {
|
||||
}
|
||||
|
||||
// IsClean checks if a repo has unstaged changes
|
||||
func IsClean(recipeName string) (bool, error) {
|
||||
recipeDir := path.Join(config.RECIPES_DIR, recipeName)
|
||||
|
||||
repo, err := git.PlainOpen(recipeDir)
|
||||
func IsClean(repoPath string) (bool, error) {
|
||||
repo, err := git.PlainOpen(repoPath)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@ -62,9 +60,9 @@ func IsClean(recipeName string) (bool, error) {
|
||||
}
|
||||
|
||||
if status.String() != "" {
|
||||
logrus.Debugf("discovered git status for %s repository: %s", recipeName, status.String())
|
||||
logrus.Debugf("discovered git status in %s: %s", repoPath, status.String())
|
||||
} else {
|
||||
logrus.Debugf("discovered clean git status for %s repository", recipeName)
|
||||
logrus.Debugf("discovered clean git status in %s", repoPath)
|
||||
}
|
||||
|
||||
return status.IsClean(), nil
|
||||
|
Reference in New Issue
Block a user