Simplify load_git_details.go; remove unnecessary Abs() call (#1950)

Suggested here
https://github.com/databricks/cli/pull/1945#discussion_r1866088579
This commit is contained in:
Denis Bilenko 2024-12-02 23:41:38 +01:00 committed by GitHub
parent 2847533e1e
commit 0e088eb9f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 6 deletions

View File

@ -55,13 +55,8 @@ func (m *loadGitDetails) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagn
b.Config.Bundle.Git.OriginURL = remoteUrl b.Config.Bundle.Git.OriginURL = remoteUrl
} }
// Compute relative path of the bundle root from the Git repo root.
absBundlePath, err := filepath.Abs(b.BundleRootPath)
if err != nil {
return diag.FromErr(err)
}
// repo.Root() returns the absolute path of the repo // repo.Root() returns the absolute path of the repo
relBundlePath, err := filepath.Rel(repo.Root(), absBundlePath) relBundlePath, err := filepath.Rel(repo.Root(), b.BundleRoot.Native())
if err != nil { if err != nil {
return diag.FromErr(err) return diag.FromErr(err)
} }