( git: ReturnType<typeof simpleGit>, )
| 267 | } |
| 268 | |
| 269 | async function getTrackingBranchStatus( |
| 270 | git: ReturnType<typeof simpleGit>, |
| 271 | ): Promise<TrackingStatus> { |
| 272 | try { |
| 273 | // Single git call - rev-list will fail if no upstream exists |
| 274 | // This is faster than checking upstream first, then counting |
| 275 | const tracking = await git.raw([ |
| 276 | "rev-list", |
| 277 | "--left-right", |
| 278 | "--count", |
| 279 | "@{upstream}...HEAD", |
| 280 | ]); |
| 281 | const [pullStr, pushStr] = tracking.trim().split(/\s+/); |
| 282 | return { |
| 283 | pushCount: Number.parseInt(pushStr || "0", 10), |
| 284 | pullCount: Number.parseInt(pullStr || "0", 10), |
| 285 | hasUpstream: true, |
| 286 | }; |
| 287 | } catch { |
| 288 | // No upstream branch configured |
| 289 | return { pushCount: 0, pullCount: 0, hasUpstream: false }; |
| 290 | } |
| 291 | } |
no outgoing calls
no test coverage detected