Local workflow, smart-HTTP clone/fetch/push and public HTTPS clone/fetch match native git in stdout and exit codes. Only WASI imports (wasi:http, exit-with-code).
9 lines
405 B
C++
9 lines
405 B
C++
/// Read HEAD without mistaking an unborn branch for an I/O error.
|
|
fn head_info(repo: &gix::Repository) -> Result<HeadInfo> {
|
|
let head = repo.head().map_err(|e| error("HEAD", e))?;
|
|
Ok(HeadInfo { detached: head.is_detached(), unborn: head.is_unborn(),
|
|
branch: head.referent_name().map(|name| name.as_bstr().to_str_lossy().into_owned()),
|
|
id: head.id().map(|id| id.to_string()) })
|
|
}
|
|
|