userland/git: git-compatible CLI on v2's gix code (T10)
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).
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
/// 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()) })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user