Skip to main content

SideRepo

Struct SideRepo 

Source
pub struct SideRepo {
    pub git_dir: PathBuf,
    pub work_tree: PathBuf,
    pub root_sha: String,
}
Expand description

Represents a side repository for a project.

Fields§

§git_dir: PathBuf

Path to the bare git repository.

§work_tree: PathBuf

Path to the work tree (the main project directory).

§root_sha: String

The initial commit SHA of the main repo (project identifier).

Implementations§

Source§

impl SideRepo

Source

pub fn open() -> Result<Self>

Resolve or create a side repo for the current project.

§Errors

Returns an error if not in a git repository or if config files cannot be accessed.

Source

pub fn is_initialized(&self) -> bool

Check if the side repo has been initialized.

Source

pub fn ensure_initialized(&self) -> Result<()>

Initialize the side repo if not already done.

§Errors

Returns an error if the directory cannot be created or git init fails.

Source

pub fn git(&self, args: &[&str]) -> Result<String>

Run a git command in the context of the side repo.

§Errors

Returns an error if the git command fails.

Source

pub fn tracked_file(&self) -> PathBuf

Get the path to the .side-tracked file.

Source

pub fn stage(&self, path: &Path) -> Result<()>

Stage a path (forced, bypassing gitignore).

§Errors

Returns an error if initialization or staging fails.

Source

pub fn stage_update(&self, paths: &[PathBuf])

Stage paths with update flag (handles modifications and deletions). Errors are ignored since paths may not be in the index yet.

Source

pub fn stage_new(&self, paths: &[PathBuf]) -> Result<()>

Stage paths (adds new files).

§Errors

Returns an error if initialization or staging fails.

Source

pub fn commit(&self, message: &str) -> Result<()>

Commit staged changes.

§Errors

Returns NothingToCommit if there are no staged changes, or an error if commit fails.

Source

pub fn status(&self) -> Result<String>

Get status output.

§Errors

Returns an error if the git status command fails.

Source

pub fn log(&self, args: &[&str]) -> Result<String>

Get log output.

§Errors

Returns an error if the git log command fails.

Source

pub fn unstage(&self, path: &Path) -> Result<()>

Remove a path from the index (unstage).

§Errors

Returns an error if the git rm command fails (though failures are typically ignored).

Source

pub fn push(&self) -> Result<()>

Force push to origin/main.

§Errors

Returns an error if the push fails (e.g. no remote configured).

Source

pub fn stage_tracked_file(&self) -> Result<()>

Stage the .side-tracked file using git plumbing. Since .side-tracked lives in git_dir (not work_tree), we use hash-object + update-index.

§Errors

Returns an error if the file doesn’t exist or git commands fail.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.