use-git 0.0.1

Feature-gated facade crate for RustUse Git vocabulary primitives
Documentation
#[test]
fn facade_reexports_core_vocabulary() -> Result<(), Box<dyn std::error::Error>> {
    let oid: use_git::GitOid = "0123456789abcdef0123456789abcdef01234567".parse()?;
    let branch = use_git::GitBranchName::new("feature/use-git")?;
    let reference = use_git::GitRefName::new("refs/heads/main")?;
    let tag = use_git::VersionTagName::new("v1.2.3")?;

    assert_eq!(oid.kind(), use_git::GitOidKind::Sha1);
    assert!(branch.is_feature());
    assert!(reference.is_branch());
    assert_eq!(tag.as_str(), "v1.2.3");
    Ok(())
}

#[test]
fn facade_exposes_namespaces() -> Result<(), Box<dyn std::error::Error>> {
    let remote = use_git::remote::GitRemoteName::origin();
    let refspec: use_git::refspec::GitRefspec = "+refs/heads/*:refs/remotes/origin/*".parse()?;
    let pathspec = use_git::pathspec::GitPathspec::new(":(top,literal)README.md")?;
    let ignore = use_git::ignore::GitIgnoreRule::parse("!target/")?;

    assert!(remote.is_origin());
    assert!(refspec.is_wildcard());
    assert!(pathspec.has_magic(use_git::pathspec::PathspecMagic::Top));
    assert!(ignore.is_directory_only());
    Ok(())
}

#[test]
fn facade_supports_status_and_attributes() -> Result<(), Box<dyn std::error::Error>> {
    let name = use_git::GitAttributeName::new("text")?;
    let rule = use_git::GitAttributeRule::new("*.rs", [(name, use_git::GitAttributeState::Set)])?;
    let status = use_git::GitStatus::new()
        .with_index(use_git::GitIndexStatus::Modified)
        .with_worktree(use_git::GitWorktreeStatus::Unmodified);

    assert_eq!(rule.pattern(), "*.rs");
    assert_eq!(status.porcelain_code(), "M ");
    Ok(())
}