pub struct GitVcs;Expand description
Git implementation of the VCS trait.
Implementations§
Source§impl GitVcs
impl GitVcs
Sourcepub fn version(&self) -> Result<GitVersion, JoyError>
pub fn version(&self) -> Result<GitVersion, JoyError>
Get the installed git version. Returns error if git is not found.
Sourcepub fn check_version(&self) -> Result<GitVersion, JoyError>
pub fn check_version(&self) -> Result<GitVersion, JoyError>
Check that git meets the minimum version requirement.
Source§impl GitVcs
impl GitVcs
Sourcepub fn is_ignored(&self, root: &Path, path: &str) -> bool
pub fn is_ignored(&self, root: &Path, path: &str) -> bool
True if path matches one of the .gitignore patterns
(regardless of whether it is currently tracked).
git check-ignore --quiet <path> exits 0 when the path is
ignored, 1 when it is not, anything else on error. Errors
are treated as “not ignored” so that genuine staging
attempts surface via the regular add error path rather
than getting swallowed here.
Sourcepub fn commit(&self, root: &Path, message: &str) -> Result<(), JoyError>
pub fn commit(&self, root: &Path, message: &str) -> Result<(), JoyError>
Create a commit with a message.
Sourcepub fn tag_annotated(
&self,
root: &Path,
name: &str,
body: &str,
) -> Result<(), JoyError>
pub fn tag_annotated( &self, root: &Path, name: &str, body: &str, ) -> Result<(), JoyError>
Create an annotated tag with a message body.
Sourcepub fn push(&self, root: &Path, remote: &str) -> Result<(), JoyError>
pub fn push(&self, root: &Path, remote: &str) -> Result<(), JoyError>
Push the current branch to a remote.
Sourcepub fn push_tag(
&self,
root: &Path,
remote: &str,
tag: &str,
) -> Result<(), JoyError>
pub fn push_tag( &self, root: &Path, remote: &str, tag: &str, ) -> Result<(), JoyError>
Push a specific tag to a remote.
Push current branch and tags in one call.
Sourcepub fn default_remote(&self, root: &Path) -> Result<String, JoyError>
pub fn default_remote(&self, root: &Path) -> Result<String, JoyError>
Get the default remote name (usually “origin”).
Sourcepub fn remote_url(&self, root: &Path, remote: &str) -> Result<String, JoyError>
pub fn remote_url(&self, root: &Path, remote: &str) -> Result<String, JoyError>
Get the remote URL for a given remote name.
Sourcepub fn all_remotes(
&self,
root: &Path,
) -> Result<Vec<(String, String)>, JoyError>
pub fn all_remotes( &self, root: &Path, ) -> Result<Vec<(String, String)>, JoyError>
List every configured remote as (name, url) pairs, in the
order git remote returns them. Empty when the repo has no
remotes configured.
Sourcepub fn is_clean(&self, root: &Path) -> Result<bool, JoyError>
pub fn is_clean(&self, root: &Path) -> Result<bool, JoyError>
Check if the working tree is clean.
Sourcepub fn head_is_tagged(&self, root: &Path) -> bool
pub fn head_is_tagged(&self, root: &Path) -> bool
Check if HEAD is exactly on a tag.
Trait Implementations§
Source§impl Vcs for GitVcs
impl Vcs for GitVcs
Source§fn is_repo(&self, root: &Path) -> bool
fn is_repo(&self, root: &Path) -> bool
Source§fn init_repo(&self, root: &Path) -> Result<(), JoyError>
fn init_repo(&self, root: &Path) -> Result<(), JoyError>
Source§fn user_email(&self) -> Result<String, JoyError>
fn user_email(&self) -> Result<String, JoyError>
Source§fn latest_version_tag(&self, root: &Path) -> Result<Option<String>, JoyError>
fn latest_version_tag(&self, root: &Path) -> Result<Option<String>, JoyError>
Source§fn config_get(&self, root: &Path, key: &str) -> Result<String, JoyError>
fn config_get(&self, root: &Path, key: &str) -> Result<String, JoyError>
git config --local <key>); other backends
implement on the closest equivalent (jj has jj config, pijul
pijul config).Source§fn config_set(
&self,
root: &Path,
key: &str,
value: &str,
) -> Result<(), JoyError>
fn config_set( &self, root: &Path, key: &str, value: &str, ) -> Result<(), JoyError>
Vcs::config_get.