Set default branch to main for clone creation (#662)
Summary
- When creating a clone without specifying a branch or snapshot, default to "main" branch
- When a specific snapshot is requested but no branch specified, use the snapshot's branch (maintains consistency)
- UI: Prioritize "main" branch in the branch selector dropdown
Changes
API (engine/internal/cloning/base.go):
- Default to "main" only when neither branch nor snapshot are specified
- Use snapshot's branch when snapshot is specified but branch is not
UI (ui/packages/shared/pages/CreateClone/index.tsx):
- Default branch selector to "main" if available, fallback to first branch
Tests (engine/internal/cloning/base_test.go):
- Added
TestDefaultBranchForCloneCreationcovering all branch selection scenarios
Behavior
| Branch Specified | Snapshot Specified | Result |
|---|---|---|
| No | No | Default to "main" |
| No | Yes | Use snapshot's branch |
| Yes | Any | Use specified branch |
Fixes: #662 (closed)
Edited by Nikolay Samokhvalov