Skip to content

Commit 3dce817

Browse files
committed
Always use commit and originUrl from the git repository
Previously users were able to override commit and originUrl in the config, this was never intended.
1 parent e57cbf1 commit 3dce817

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

bundle/config/mutator/load_git_details.go

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,12 @@ func (m *loadGitDetails) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagn
4040
log.Warnf(ctx, "failed to load current branch: %s", err)
4141
}
4242

43-
// load commit hash if undefined
44-
if b.Config.Bundle.Git.Commit == "" {
45-
commit, err := repo.LatestCommit()
46-
if err != nil {
47-
log.Warnf(ctx, "failed to load latest commit: %s", err)
48-
} else {
49-
b.Config.Bundle.Git.Commit = commit
50-
}
51-
}
52-
// load origin url if undefined
53-
if b.Config.Bundle.Git.OriginURL == "" {
54-
remoteUrl := repo.OriginUrl()
55-
b.Config.Bundle.Git.OriginURL = remoteUrl
43+
commit, err := repo.LatestCommit()
44+
if err != nil {
45+
log.Warnf(ctx, "failed to load latest commit: %s", err)
5646
}
47+
b.Config.Bundle.Git.Commit = commit
48+
b.Config.Bundle.Git.OriginURL = repo.OriginUrl()
5749

5850
// Compute relative path of the bundle root from the Git repo root.
5951
absBundlePath, err := filepath.Abs(b.BundleRootPath)

0 commit comments

Comments
 (0)