diff --git a/bundle/config/mutator/load_git_details.go b/bundle/config/mutator/load_git_details.go index 00e7f54d..76acefc1 100644 --- a/bundle/config/mutator/load_git_details.go +++ b/bundle/config/mutator/load_git_details.go @@ -40,20 +40,12 @@ func (m *loadGitDetails) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagn log.Warnf(ctx, "failed to load current branch: %s", err) } - // load commit hash if undefined - if b.Config.Bundle.Git.Commit == "" { - commit, err := repo.LatestCommit() - if err != nil { - log.Warnf(ctx, "failed to load latest commit: %s", err) - } else { - b.Config.Bundle.Git.Commit = commit - } - } - // load origin url if undefined - if b.Config.Bundle.Git.OriginURL == "" { - remoteUrl := repo.OriginUrl() - b.Config.Bundle.Git.OriginURL = remoteUrl + commit, err := repo.LatestCommit() + if err != nil { + log.Warnf(ctx, "failed to load latest commit: %s", err) } + b.Config.Bundle.Git.Commit = commit + b.Config.Bundle.Git.OriginURL = repo.OriginUrl() // Compute relative path of the bundle root from the Git repo root. absBundlePath, err := filepath.Abs(b.BundleRootPath)