Skip to main content

resolve_symbolic_head

Function resolve_symbolic_head 

Source
pub fn resolve_symbolic_head(
    context: &GitContext,
    cwd: &Path,
    ref_files: &RefFilesLayout<'_>,
) -> Result<SymbolicHead, GitFailure>
Expand description

What: Resolves the symbolic HEAD target in the owning worktree. Why: The HEAD file answers when it is one of the two plain spellings on the files backend, read afresh on every call so the landing’s re-read stays a read at landing time; anything else asks Git, where exit 1 from symbolic-ref --quiet means detached and any other failure is an error.

In TS you’d write (pseudocode):

readHeadFile(refFiles) ?? (await resolveSymbolicHeadWithGit({ gitPath, cwd }));