Skip to main content

GitSource

Struct GitSource 

Source
pub struct GitSource { /* private fields */ }
Expand description

Shell-out driver for the source tracker. Everything goes through Git’s public interface — never into .git directly — so it works identically against a clone or, later, a projection.

Implementations§

Source§

impl GitSource

Source

pub fn open(root: &Utf8Path, substrate: SourceSubstrate) -> Result<Self>

Source

pub fn root(&self) -> &Utf8Path

Source

pub fn is_ignored(&self, path: &str) -> Result<bool>

Whether the store repo’s gitignore rules cover path (which need not exist yet) — used to enforce the tracker-path invariant.

Source

pub fn is_tracked(&self, path: &str) -> Result<bool>

Whether path is tracked by the store repo — a tracker path that is also in Git history is dual-tracked, deliberately or not.

Source

pub fn branch_exists(&self, name: &str) -> Result<bool>

Source

pub fn create_branch(&self, name: &str, base: &str) -> Result<()>

Source

pub fn rev_parse(&self, revision: &str) -> Result<String>

Source

pub fn clone_to(&self, branch: &str, destination: &Utf8Path) -> Result<()>

Materialize branch as a full standalone clone at destination. A local-path clone hardlinks objects; never --shared/--reference.

Source

pub fn fetch_ref( &self, from: &Utf8Path, remote_ref: &str, local_ref: &str, ) -> Result<()>

Fetch a ref from another repository (typically a workspace clone) into the store. Fetch, never push: the store pulls commits in when a checkpoint blesses them, and workspaces stay passive.

Source

pub fn update_ref(&self, name: &str, rev: &str) -> Result<()>

Source

pub fn ref_rev(&self, name: &str) -> Option<String>

Resolve a ref to a commit, when it exists.

Source

pub fn is_ancestor(&self, ancestor: &str, descendant: &str) -> Result<bool>

Source

pub fn workspace_short_head(workspace: &Utf8Path) -> Result<String>

Live HEAD of a workspace clone, short form.

Source

pub fn workspace_head(workspace: &Utf8Path) -> Result<String>

Live HEAD of a workspace clone, full form.

Source

pub fn workspace_dirty_commit( workspace: &Utf8Path, message: &str, ) -> Result<Option<String>>

Snapshot uncommitted and untracked (non-ignored) workspace state as a dangling commit on top of HEAD, without touching HEAD, the real index, or the worktree. Returns None when the worktree is clean.

Mechanics: a throwaway GIT_INDEX_FILE seeded from HEAD, git add -A into it, git write-tree, and git commit-tree — all public interface, nothing reaches into .git internals.

Source

pub fn workspace_update_ref( workspace: &Utf8Path, name: &str, rev: &str, ) -> Result<()>

Source

pub fn workspace_delete_ref(workspace: &Utf8Path, name: &str) -> Result<()>

Source

pub fn workspace_fetch_ref( workspace: &Utf8Path, from: &Utf8Path, remote_ref: &str, ) -> Result<()>

Fetch a store ref into a workspace clone (undo may need objects the workspace has since discarded).

Source

pub fn workspace_restore_to( workspace: &Utf8Path, head_rev: &str, dirty_rev: Option<&str>, ) -> Result<()>

Put a workspace back to a checkpointed source state: HEAD hard-reset to head_rev, untracked (non-ignored) files removed, then — when the checkpoint carried uncommitted state — that state reapplied to the worktree as uncommitted changes again. Ignored files (tracker paths, node_modules) are deliberately left alone; trackers and resources own their restoration.

Source

pub fn workspace_tracked_files(workspace: &Utf8Path) -> Result<Vec<Utf8PathBuf>>

Every path the workspace’s Git tracks, workspace-relative. This is what “the source content of this branch” means for export: tracked files as they stand on disk, so uncommitted edits are included and ignored junk never is.

Source

pub fn init_export_repo( destination: &Utf8Path, branch: &str, message: &str, ) -> Result<String>

Turn a directory of already-placed files into an ordinary Git repository with one commit on branch. Returns the commit.

One commit, never a history rewrite: exporting the workspace’s Git history would carry every file any past commit contained, which is exactly the content the audience filter just excluded.

Trait Implementations§

Source§

impl Clone for GitSource

Source§

fn clone(&self) -> GitSource

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GitSource

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for GitSource

Source§

impl PartialEq for GitSource

Source§

fn eq(&self, other: &GitSource) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for GitSource

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.