Commit 887ea1d
committed
fix: validate default branch exists before setting HEAD in List method
The List method was blindly setting HEAD to point to the configured default
branch without verifying the branch actually exists. This caused "couldn't
find remote ref" errors when cloning repositories with misconfigured default
branches (e.g., pointing to non-existent "master" branch).
Changes:
- Add validation to check if configured default branch exists
- Implement fallback logic: prefer "main" branch, then first available branch
- Add warning logs when falling back to different branch
- Handle edge case of repositories with no branches
- Prevent fatal clone errors due to invalid HEAD references
Fixes scenarios where repository default branch configuration points to
non-existent branches, improving clone reliability and user experience.1 parent faed7fa commit 887ea1d
1 file changed
+32
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
125 | 130 | | |
126 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
127 | 144 | | |
128 | 145 | | |
129 | 146 | | |
| |||
140 | 157 | | |
141 | 158 | | |
142 | 159 | | |
143 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
144 | 172 | | |
145 | 173 | | |
146 | 174 | | |
| |||
152 | 180 | | |
153 | 181 | | |
154 | 182 | | |
155 | | - | |
| 183 | + | |
156 | 184 | | |
157 | 185 | | |
158 | 186 | | |
| |||
168 | 196 | | |
169 | 197 | | |
170 | 198 | | |
171 | | - | |
| 199 | + | |
172 | 200 | | |
173 | 201 | | |
174 | 202 | | |
175 | 203 | | |
176 | | - | |
| 204 | + | |
177 | 205 | | |
178 | 206 | | |
179 | 207 | | |
| |||
0 commit comments