Skip to content

Commit e76c666

Browse files
author
Antonio Salinas
committed
fix: gate dist-git behind applyOverlays
1 parent 738cdac commit e76c666

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

internal/app/azldev/core/sources/sourceprep.go

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@ func (p *sourcePreparerImpl) PrepareSources(
152152
if err != nil {
153153
return err
154154
}
155-
}
156155

157-
// Record the changes as synthetic git history when dist-git creation is enabled.
158-
if p.withGitRepo {
159-
if err := p.trySyntheticHistory(component, outputDir); err != nil {
160-
return fmt.Errorf("failed to generate synthetic history for component %#q:\n%w",
161-
component.GetName(), err)
156+
// Record the changes as synthetic git history when dist-git creation is enabled.
157+
if p.withGitRepo {
158+
if err := p.trySyntheticHistory(component, outputDir); err != nil {
159+
return fmt.Errorf("failed to generate synthetic history for component %#q:\n%w",
160+
component.GetName(), err)
161+
}
162162
}
163163
}
164164

@@ -310,19 +310,13 @@ func (p *sourcePreparerImpl) trySyntheticHistory(
310310
return nil
311311
}
312312

313-
// Bump the static Release tag before staging changes. For specs using
314-
// %autorelease this is a no-op; rpmautospec resolves releases from git
315-
// history automatically. For static releases the leading integer is
316-
// incremented by the number of synthetic commits so that every project
317-
// commit that affects the component produces a unique release number.
313+
// Adjust the Release tag before staging changes. See [tryBumpStaticRelease]
314+
// for the handling of %autorelease, static integers, and non-standard values.
318315
if err := p.tryBumpStaticRelease(component, sourcesDirPath, len(commits)); err != nil {
319316
return fmt.Errorf("failed to apply release bump:\n%w", err)
320317
}
321318

322-
// Check for an existing git repository in the sources directory.
323-
// Use os.Stat rather than p.fs because go-git's PlainInit/PlainOpen always
324-
// operate on the real OS filesystem — the check must use the same source of
325-
// truth to avoid disagreement when p.fs is an in-memory FS (e.g. unit tests).
319+
// Use os.Stat (not p.fs) because go-git always operates on the real filesystem.
326320
gitDirPath := filepath.Join(sourcesDirPath, ".git")
327321

328322
_, statErr := os.Stat(gitDirPath)

0 commit comments

Comments
 (0)