sr-git
Git operations for sr — backed by the native git CLI.
Overview
sr-git provides NativeGitRepository, a concrete implementation of the GitRepository trait from sr-core. It shells out to the git binary for all operations — tag discovery, commit listing, tagging, pushing, and staging.
Usage
[]
= "0.1"
Opening a repository
use NativeGitRepository;
use GitRepository;
use Path;
let repo = open?;
// Use any GitRepository trait method
let tag = repo.latest_tag?;
let commits = repo.commits_since?;
Parsing a remote URL
use parse_owner_repo;
// Supports both SSH and HTTPS formats
let = parse_owner_repo?;
assert_eq!;
assert_eq!;
let = parse_owner_repo?;
assert_eq!;
assert_eq!;
API
| Item | Description |
|---|---|
NativeGitRepository::open(path) |
Open a git repository at the given path |
NativeGitRepository::parse_remote() |
Extract (owner, repo) from the git remote URL |
parse_owner_repo(url) |
Standalone helper to parse owner/repo from a GitHub remote URL |
NativeGitRepository implements all methods of the GitRepository trait — see sr-core for the full trait definition.
Prerequisites
Requires git to be installed and available on PATH.