Skip to content

Commit

Permalink
Merge pull request #13166 from hashicorp/backport/fix_panic_on_empty_…
Browse files Browse the repository at this point in the history
…git_repo_hcp/cheaply-mature-sunfish

This pull request was automerged via backport-assistant
  • Loading branch information
hc-github-team-packer authored Sep 13, 2024
2 parents 97fc630 + 2dee325 commit 3aa4c05
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions internal/hcp/registry/metadata/vcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 3aa4c05

Please sign in to comment.