Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions git.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"strings"

"github.com/apex/log"
"github.com/pkg/errors"
)

// gitHash generates a version string similar to git describe --always
Expand Down Expand Up @@ -56,28 +55,3 @@ func GitVersion(path string) (string, error) {

return vers + "-dirty", nil
}

// NewGitLayerTag version generates a commit-<id> tag to be used for uploading an image to a docker registry
func NewGitLayerTag(path string) (string, error) {

// Check if there are local changes
args := []string{"-C", path, "status", "--porcelain", "--untracked-files=no"}
output, err := exec.Command("git", args...).CombinedOutput()
if err != nil {
return "", err
}

// If there are local changes, we don't generate a git commit tag for the new layer
if len(output) != 0 {
return "", errors.Errorf("commit is dirty so don't generate a tag based on git commit: %s", output)
}

// Determine git hash
hash, err := gitHash(path, true)
if err != nil {
return "", err
}

// Add commit id in tag
return "commit-" + hash, nil
}