refactor!: simplifying publish logic
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-12-27 19:56:27 +01:00
parent eb1b6be4c5
commit 0aa37fcee8
10 changed files with 137 additions and 168 deletions

View File

@ -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