git-codeowners icon indicating copy to clipboard operation
git-codeowners copied to clipboard

feat: Discover current repository

Open spencerwilson opened this issue 5 years ago • 0 comments

git2 is a crate of Rust bindings to libgit2. The git book suggests it's the dominant way to "embed" git-like functionality in apps w/o shelling out to the git binary.

Cargo.lock changes are the result of running cargo build on this branch, w/ cargo version 1.39.0.

Manual tests:

# State of this branch:
~/code/git-codeowners/src
$ ../target/debug/git-codeowners src/main.rs
@softprops

# When temporarily deleting CODEOWNERS
~/code/git-codeowners/src
$ ../target/debug/git-codeowners src/main.rs
No CODEOWNERS file found in this repo.
Ensure one exists at any of the locations documented here:
https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-file-location

# When outside of a git repo
~/code
$ ./git-codeowners/target/debug/git-codeowners src/main.rs
Repo discovery failed. Is /Users/ssw/code within a git repository? Error: could not find repository from '/Users/spencer/code'; class=Repository (6); code=NotFound (-3)

Resolves #3.

spencerwilson avatar Nov 12 '19 02:11 spencerwilson