diff options
| author | Christian Cleberg <[email protected]> | 2026-04-01 23:37:12 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-01 23:37:12 -0500 |
| commit | 0bef9acc515cfcb4ac6e2530cd34cbdbc47c2c1d (patch) | |
| tree | 4457ca8d3fcc1f53383c9da46e19661a039834df /codex-fix-refs-type-conflict.md | |
| parent | a83893afa086f0050c825144fa818024db4df056 (diff) | |
| download | hutch-2.8.1.tar.gz hutch-2.8.1.tar.bz2 hutch-2.8.1.zip | |
feat: show commit dates in Refs tabv2.8.1
Diffstat (limited to 'codex-fix-refs-type-conflict.md')
| -rw-r--r-- | codex-fix-refs-type-conflict.md | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/codex-fix-refs-type-conflict.md b/codex-fix-refs-type-conflict.md new file mode 100644 index 0000000..4ff2eec --- /dev/null +++ b/codex-fix-refs-type-conflict.md @@ -0,0 +1,89 @@ +# Fix: Conflicting `[Reference]` vs `[ReferenceDetail]` in RepositorySettingsView + +## Background + +`RepositoryDetailViewModel.branches` was recently changed from `[Reference]` to +`[ReferenceDetail]` to support displaying commit dates in the Refs tab. +`ReferenceDetail` has the same `name: String` and `target: String?` fields as +`Reference`, plus an additional `date: Date?`. + +`RepositorySettingsView` and `RepositorySettingsViewModel` still declare their +`branches` parameter as `[Reference]`, causing this compiler error: + +``` +RepositoryDetailView.swift:56:51 +Conflicting arguments to generic parameter 'T' ('[ReferenceDetail]' vs. '[Reference]') +``` + +The settings view model only uses `branches` for the HEAD branch picker +(`selectedHeadReferenceForSave()` accesses `$0.name`). No mapping back to +`Reference` is needed — just update the type throughout the settings layer. + +--- + +## Changes Required + +### 1. `Hutch/Views/Repositories/RepositorySettingsViewModel.swift` + +**Change the stored property type:** + +Find: +```swift +var branches: [Reference] +``` + +Replace with: +```swift +var branches: [ReferenceDetail] +``` + +**Change the `init` parameter type:** + +Find: +```swift +init( + repository: RepositorySummary, + branches: [Reference], + client: SRHTClient +) { +``` + +Replace with: +```swift +init( + repository: RepositorySummary, + branches: [ReferenceDetail], + client: SRHTClient +) { +``` + +### 2. `Hutch/Views/Repositories/RepositorySettingsView.swift` + +**Change the stored property type:** + +Find: +```swift +let branches: [Reference] +``` + +Replace with: +```swift +let branches: [ReferenceDetail] +``` + +--- + +## No Other Changes + +- Do not modify `Reference` or `ReferenceDetail` in `Git.swift`. +- Do not modify `RepositoryDetailView.swift` — the call site is already correct. +- Do not modify `ReferencesListView.swift` or `RepositoryDetailViewModel.swift`. +- `selectedHeadReferenceForSave()` in the settings view model accesses only + `$0.name` on each branch, which exists on `ReferenceDetail` — no logic + changes are needed. + +## Verification + +Build the project. The compiler error at `RepositoryDetailView.swift:56` should +be gone. Confirm the repository settings sheet still opens and the HEAD branch +picker populates correctly. |
