Skip to content

Commit 9f48561

Browse files
committed
Fix source path for apply in dev mode
1 parent 5483e33 commit 9f48561

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

internal/server/apply.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,13 @@ func appDefToApplyInfo(appDef *starlarkstruct.Struct) (*types.CreateAppRequest,
198198
}, nil
199199
}
200200

201-
func (s *Server) setupSource(applyPath, branch, commit, gitAuth string, repoCache *RepoCache) (string, string, error) {
201+
func (s *Server) setupSource(applyPath, branch, commit, gitAuth string, repoCache *RepoCache, isDev bool) (string, string, error) {
202202
if !system.IsGit(applyPath) {
203203
return filepath.Dir(applyPath), filepath.Base(applyPath), nil
204204
}
205205

206206
branch = cmp.Or(branch, "main")
207-
repo, applyFile, _, _, err := repoCache.CheckoutRepo(applyPath, branch, commit, gitAuth, false)
207+
repo, applyFile, _, _, err := repoCache.CheckoutRepo(applyPath, branch, commit, gitAuth, isDev)
208208
if err != nil {
209209
return "", "", err
210210
}
@@ -220,7 +220,7 @@ func (s *Server) setupSource(applyPath, branch, commit, gitAuth string, repoCach
220220

221221
func (s *Server) Apply(ctx context.Context, inputTx types.Transaction, applyPath string, appPathGlob string, approve, dryRun, promote bool,
222222
reload types.AppReloadOption, branch, commit, gitAuth string, clobber,
223-
forceReload bool, lastRunCommitId string, repoCache *RepoCache, dev bool) (*types.AppApplyResponse, []types.AppPathDomain, error) {
223+
forceReload bool, lastRunCommitId string, repoCache *RepoCache, isDev bool) (*types.AppApplyResponse, []types.AppPathDomain, error) {
224224
var tx types.Transaction
225225
var err error
226226
if inputTx.Tx == nil {
@@ -265,7 +265,7 @@ func (s *Server) Apply(ctx context.Context, inputTx types.Transaction, applyPath
265265
}
266266
}
267267

268-
dir, file, err := s.setupSource(applyPath, branch, commit, gitAuth, repoCache)
268+
dir, file, err := s.setupSource(applyPath, branch, commit, gitAuth, repoCache, isDev)
269269
if err != nil {
270270
return nil, nil, err
271271
}
@@ -294,7 +294,7 @@ func (s *Server) Apply(ctx context.Context, inputTx types.Transaction, applyPath
294294
return nil, nil, fmt.Errorf("error reading file %s: %w", f, err)
295295
}
296296

297-
fileConfig, err := s.loadApplyInfo(f, fileBytes, branch, dev)
297+
fileConfig, err := s.loadApplyInfo(f, fileBytes, branch, isDev)
298298
if err != nil {
299299
return nil, nil, err
300300
}
@@ -370,8 +370,8 @@ func (s *Server) Apply(ctx context.Context, inputTx types.Transaction, applyPath
370370
for _, newApp := range newApps {
371371
s.Trace().Msgf("Applying create app %s", newApp)
372372
applyInfo := applyConfig[newApp]
373-
if dev {
374-
applyInfo.IsDev = dev // Override the dev status from the apply command cli
373+
if isDev {
374+
applyInfo.IsDev = isDev // Override the dev status from the apply command cli
375375
}
376376
res, err := s.CreateAppTx(ctx, tx, newApp.String(), approve, dryRun, applyInfo, repoCache)
377377
if err != nil {

0 commit comments

Comments
 (0)