| 385 | } |
| 386 | |
| 387 | func (r *Repository) commitWorktreeChanges(ctx context.Context, worktreePath, explanation string) error { |
| 388 | return r.lockManager.WithLock(ctx, LockTypeForkRepo, func() error { |
| 389 | status, err := RunGitCommand(ctx, worktreePath, "status", "--porcelain") |
| 390 | if err != nil { |
| 391 | return err |
| 392 | } |
| 393 | |
| 394 | if strings.TrimSpace(status) == "" { |
| 395 | return nil |
| 396 | } |
| 397 | |
| 398 | if err := r.addNonBinaryFiles(ctx, worktreePath); err != nil { |
| 399 | return err |
| 400 | } |
| 401 | |
| 402 | _, err = RunGitCommand(ctx, worktreePath, "commit", "--allow-empty", "--allow-empty-message", "-m", explanation) |
| 403 | return err |
| 404 | }) |
| 405 | } |
| 406 | |
| 407 | // AI slop below! |
| 408 | // this is just to keep us moving fast because big git repos get hard to work with |