fix: use working clones for git repos
- Create normal working clones for remote repositories - Initialize blank repositories with a main branch - Align pull and branch helpers with unborn HEAD handling - Gate fetch/pull on repositories with a remote Quality gates: vitest repositories-settings-tab (passed); api pytest blocked by missing fastapi in environment
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
## Context
|
||||
|
||||
Repository creation currently produces mirrored bare repos for any remote clone and bare repos for blank creations. The workspace, file browser, commit editor, and git toolbar are built around a working-tree repository model, so users can hit 400s when they try to sync or when the repo has no usable branch state.
|
||||
|
||||
## Goals
|
||||
|
||||
- Create working clones for remote repositories
|
||||
- Create working repos with an initial branch for blank repositories
|
||||
- Preserve the existing repository create endpoint and shared UI flow
|
||||
- Keep fetch/pull/push aligned with a normal local clone
|
||||
|
||||
## Decisions
|
||||
|
||||
1. Clone mode
|
||||
- Use `git clone` without `--mirror`
|
||||
- Keep the existing remote URL preflight and URL parsing behavior
|
||||
|
||||
2. Blank repositories
|
||||
- Initialize with `git init -b main` when supported
|
||||
- Fall back to `git init` plus `git symbolic-ref HEAD refs/heads/main` if needed
|
||||
|
||||
3. Branch state
|
||||
- Treat `main` as the initial branch name for blank repos
|
||||
- Make branch listing and current-branch helpers tolerate unborn `HEAD`
|
||||
|
||||
4. Pull behavior
|
||||
- Prefer the current branch when no explicit branch is supplied
|
||||
- Do not force `origin <branch>` if the branch is unborn or already tracked by the current checkout
|
||||
|
||||
## Risks
|
||||
|
||||
- Some older git versions may not support `git init -b`; the backend should fall back cleanly
|
||||
- Existing blank repos created under the old bare model may still require migration or cleanup outside this change
|
||||
@@ -0,0 +1,17 @@
|
||||
## Why
|
||||
|
||||
The current repository creation flow creates mirrored bare repositories for clone-based repos. That breaks the workspace model because the UI and file editing features expect a normal working clone with an initial branch, remote tracking, and pull/fetch behavior that works from a checked-out branch.
|
||||
|
||||
## What Changes
|
||||
|
||||
- Create clone-based repositories as normal working clones instead of mirrors
|
||||
- Initialize blank repositories as working clones with an initial branch when needed
|
||||
- Ensure newly created repos have a usable current branch for workspace browsing and commits
|
||||
- Update pull semantics to use the current tracked branch when available
|
||||
- Keep fetch behavior available for remote-synced repositories
|
||||
|
||||
## Impact
|
||||
|
||||
- Backend: repository creation and git control helpers
|
||||
- Backend tests: clone, pull, and empty-repo branch behavior
|
||||
- Frontend: no intentional UX change beyond sync behavior becoming reliable
|
||||
@@ -0,0 +1,19 @@
|
||||
## 1. Backend - Repository Creation
|
||||
|
||||
- [x] 1.1 Switch clone-based repository creation from mirror clones to normal working clones
|
||||
- [x] 1.2 Initialize blank repositories with a default branch name
|
||||
- [x] 1.3 Preserve remote preflight and clear error handling
|
||||
|
||||
## 2. Backend - Git Sync Helpers
|
||||
|
||||
- [x] 2.1 Update pull behavior to use the current tracked branch when available
|
||||
- [x] 2.2 Make branch helpers tolerate unborn HEAD in blank repos
|
||||
|
||||
## 3. Tests
|
||||
|
||||
- [x] 3.1 Add unit coverage for clone creation and blank repo initialization
|
||||
- [x] 3.2 Add coverage for pull behavior on working clones and blank repos
|
||||
|
||||
## 4. Quality Gates
|
||||
|
||||
- [ ] 4.1 Run targeted API tests
|
||||
Reference in New Issue
Block a user