fetchRefToRefspec converts a user-facing fetch pattern to a git refspec. Special values: - "*" → "+refs/heads/*:refs/remotes/origin/*" - "refs/pulls/open/*" → "+refs/pull/*/head:refs/remotes/origin/pull/*/head" All other values are treated as branch names or glob patterns and mapped to
(pattern string)
| 612 | // All other values are treated as branch names or glob patterns and mapped to |
| 613 | // the canonical remote-tracking refspec form. |
| 614 | func fetchRefToRefspec(pattern string) string { |
| 615 | switch pattern { |
| 616 | case "*": |
| 617 | checkoutManagerLog.Print("Fetch refspec: wildcard expanded to all branches") |
| 618 | return "+refs/heads/*:refs/remotes/origin/*" |
| 619 | case "refs/pulls/open/*": |
| 620 | checkoutManagerLog.Print("Fetch refspec: open PRs pattern expanded") |
| 621 | return "+refs/pull/*/head:refs/remotes/origin/pull/*/head" |
| 622 | default: |
| 623 | // Treat as branch name or glob: map to remote tracking ref |
| 624 | return fmt.Sprintf("+refs/heads/%s:refs/remotes/origin/%s", pattern, pattern) |
| 625 | } |
| 626 | } |
| 627 | |
| 628 | // generateFetchStepLines generates a "Fetch additional refs" YAML step for the given checkout |
| 629 | // entry when it has fetch refs configured. Returns an empty string when there are no fetch refs. |