(opts: CurrentBranchWithDeps)
| 331 | * HEAD (matching `git symbolic-ref -q HEAD`'s exit-1 case). |
| 332 | */ |
| 333 | export async function currentBranchWith(opts: CurrentBranchWithDeps): Promise<string | undefined> { |
| 334 | const dir = opts.dir ?? "/"; |
| 335 | try { |
| 336 | const name = await opts.git.currentBranch({ |
| 337 | fs: opts.fs, |
| 338 | dir, |
| 339 | fullname: opts.fullname, |
| 340 | }); |
| 341 | return name ?? undefined; |
| 342 | } catch (cause) { |
| 343 | if (isNotARepositoryCause(cause)) throw new NotARepositoryError(dir, { cause }); |
| 344 | throw new GitError("ECURRENTBRANCHFAIL", `git symbolic-ref failed: ${errorMessage(cause)}`, { |
| 345 | cause, |
| 346 | }); |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | // --------------------------------------------------------------- |
| 351 | // ls-files |
no test coverage detected