checkCleanWorkingDirectory checks if there are uncommitted changes
(verbose bool)
| 524 | |
| 525 | // checkCleanWorkingDirectory checks if there are uncommitted changes |
| 526 | func checkCleanWorkingDirectory(verbose bool) error { |
| 527 | console.LogVerbose(verbose, "Checking for uncommitted changes...") |
| 528 | |
| 529 | cmd := exec.Command("git", "status", "--porcelain") |
| 530 | output, err := cmd.Output() |
| 531 | if err != nil { |
| 532 | return fmt.Errorf("failed to check git status: %w", err) |
| 533 | } |
| 534 | |
| 535 | if len(strings.TrimSpace(string(output))) > 0 { |
| 536 | return errors.New("working directory has uncommitted changes, please commit or stash them first") |
| 537 | } |
| 538 | |
| 539 | console.LogVerbose(verbose, "Working directory is clean") |
| 540 | return nil |
| 541 | } |
| 542 | |
| 543 | // WorkflowFileStatus represents the status of a workflow file in git |
| 544 | type WorkflowFileStatus struct { |
no test coverage detected