Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions internal/cli/service_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,18 @@ func (s Service) InitiateRun(cfg InitiateRunConfig) (*api.InitiateRunResult, err
return nil, err
}

sha, err := s.GitClient.GetCommit()
if err != nil {
return nil, errors.Wrap(err, "unable to determine git commit")
// Check if git operations are disabled
_, gitPatchDisabled := os.LookupEnv("RWX_DISABLE_GIT_PATCH")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be pretty straightforward to test. There's even some old git history from when we were rolling this out that originally behaved this way.


var sha, branch, originUrl string
if !gitPatchDisabled {
sha, err = s.GitClient.GetCommit()
if err != nil {
return nil, errors.Wrap(err, "unable to determine git commit")
}
branch = s.GitClient.GetBranch()
originUrl = s.GitClient.GetOriginUrl()
}
branch := s.GitClient.GetBranch()
originUrl := s.GitClient.GetOriginUrl()
patchFile := git.PatchFile{}

// When there's no .rwx directory, create a temporary one for patches and to set run.dir
Expand All @@ -72,10 +78,7 @@ func (s Service) InitiateRun(cfg InitiateRunConfig) (*api.InitiateRunResult, err
defer os.RemoveAll(patchDir)

// Generate patches if enabled
patchable := true
if _, ok := os.LookupEnv("RWX_DISABLE_GIT_PATCH"); ok {
patchable = false
}
patchable := !gitPatchDisabled

// Convert to relative path for display purposes (e.g., run title)
relativeRunDefinitionPath := relativePathFromWd(runDefinitionPath)
Expand Down