Merge pull request #13166 from hashicorp/backport/fix_panic_on_empty_git_repo_hcp/cheaply-mature-sunfish

This pull request was automerged via backport-assistant
backport/s3-community-provisioner/partially-dominant-mole
hc-github-team-packer 2 years ago committed by GitHub
commit 3aa4c05e10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -53,13 +53,14 @@ func (g *Git) Type() string {
}
func (g *Git) Details() map[string]interface{} {
resp := map[string]interface{}{}
headRef, err := g.repo.Head()
if err != nil {
log.Printf("[ERROR] failed to get the git branch name: %s", err)
} else {
resp["ref"] = headRef.Name().Short()
log.Printf("[ERROR] failed to get reference to git HEAD: %s", err)
return nil
}
resp := map[string]interface{}{
"ref": headRef.Name().Short(),
}
commit, err := g.repo.CommitObject(headRef.Hash())

Loading…
Cancel
Save