(projectId: string)
| 153 | } |
| 154 | |
| 155 | export async function loadProjectGitState(projectId: string): Promise<ProjectGitState> { |
| 156 | const gitOpsModeOverride = getProjectGitOpsModeOverride(projectId) |
| 157 | |
| 158 | if (!(await isGitRepository(projectId))) { |
| 159 | return { |
| 160 | projectId, |
| 161 | isGitRepo: false, |
| 162 | branch: null, |
| 163 | fileCount: 0, |
| 164 | stagedFileCount: 0, |
| 165 | unstagedFileCount: 0, |
| 166 | insertions: 0, |
| 167 | deletions: 0, |
| 168 | hasOrigin: false, |
| 169 | originName: null, |
| 170 | originUrl: null, |
| 171 | gitOpsModeOverride, |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | const [branch, statusSummary, originUrl, stats] = await Promise.all([ |
| 176 | getBranch(projectId), |
| 177 | getStatusSummary(projectId), |
| 178 | getOriginUrl(projectId), |
| 179 | getDiffStats(projectId), |
| 180 | ]) |
| 181 | |
| 182 | return { |
| 183 | projectId, |
| 184 | isGitRepo: true, |
| 185 | branch, |
| 186 | fileCount: statusSummary.fileCount, |
| 187 | stagedFileCount: statusSummary.stagedFileCount, |
| 188 | unstagedFileCount: statusSummary.unstagedFileCount, |
| 189 | insertions: stats.insertions, |
| 190 | deletions: stats.deletions, |
| 191 | hasOrigin: originUrl !== null, |
| 192 | originName: deriveOriginName(originUrl), |
| 193 | originUrl, |
| 194 | gitOpsModeOverride, |
| 195 | } |
| 196 | } |
no test coverage detected