Skip to main content

GitBridge

Struct GitBridge 

Source
pub struct GitBridge<'a> { /* private fields */ }
Expand description

Git bridge for Heddle repository.

Implementations§

Source§

impl<'a> GitBridge<'a>

Source

pub fn new(heddle_repo: &'a HeddleRepository) -> Self

Create a new Git bridge for a Heddle repository.

Source

pub fn init_mirror(&mut self) -> GitResult<()>

Initialize a Git mirror in the .heddle/git directory.

Source

pub fn mirror_path(&self) -> PathBuf

Get the path to the Git mirror directory.

Source

pub fn is_initialized(&self) -> bool

Check if a Git mirror is initialized.

Source

pub fn export(&mut self) -> GitResult<ExportStats>

Export all Heddle states to Git commits.

Source

pub fn push(&mut self, remote_name: &str) -> GitResult<Vec<String>>

Push to a Git remote. Returns the full names of the refs written at the destination this invocation (see Self::push_with_scope_force).

Source

pub fn push_with_scope( &mut self, remote_name: &str, scope: GitPushScope, ) -> GitResult<Vec<String>>

Push to a Git remote with an explicit ref scope. Returns the full names of the refs written at the destination this invocation.

Source

pub fn push_with_scope_force( &mut self, remote_name: &str, scope: GitPushScope, force: bool, ) -> GitResult<Vec<String>>

Push to a Git remote with an explicit ref scope and optional non-fast-forward ref movement.

Returns the full names (e.g. refs/heads/<thread>, refs/notes/heddle, refs/tags/<tag>) of the refs WRITTEN at the destination this invocation — creations, fast-forwards, and forced rewinds — sorted for deterministic output. A no-op push returns an empty list. Retraction deletes are not included.

Source

pub fn export_to_path(&mut self, target_path: &Path) -> GitResult<ExportStats>

Export current Heddle state into the internal mirror, then write it out as a bare git repository at target_path. Auto-initializes target_path as a bare repo if it does not already exist.

Source

pub fn fetch(&mut self, remote_name: &str) -> GitResult<()>

Fetch Git refs and objects into the internal mirror without moving Heddle thread refs or the current worktree.

Source

pub fn pull(&mut self, remote_name: &str) -> GitResult<GitPullOutcome>

Pull from a Git remote.

Source

pub fn write_through_current_checkout( &mut self, ) -> GitResult<WriteThroughOutcome>

Make the checkout’s real .git view agree with the current Heddle thread: copy exported objects from the internal mirror, advance the matching Git branch, attach HEAD, and rebuild the Git index from the exported commit tree.

Source

pub fn write_through_current_checkout_with_message( &mut self, state_id: ChangeId, message: String, ) -> GitResult<WriteThroughOutcome>

Source

pub fn update_intent_to_add(&self, state_id: &ChangeId) -> GitResult<()>

Mark files that Heddle has captured but that Git still sees as untracked as intent-to-add in the colocated checkout’s index, so a colocated developer’s git status shows AM new_file (“Heddle knows about it; no Git blob committed yet”) instead of ?? new_file (“untracked — Git knows nothing”). The placeholder entry uses the empty-blob oid and a zeroed stat, so Git always reports the working-tree content as modified-against-index.

Ported from jujutsu’s update_intent_to_add (lib/src/git.rs), which diffs old_tree vs new_tree and flags paths present in the new tree but absent from the old one. Here new_tree is the just-captured Heddle state’s tree and old_tree is whatever the checkout’s index already tracks — paths already in the index are not ??, so they are left untouched (no spurious marking of tracked or unchanged files).

Call frequency mirrors jj: this fires at a Heddle parent/state change (capture), not on every command. A later checkpoint rebuilds the index from the committed tree via Self::write_through_current_checkout, replacing these placeholder entries with real ones — so the index is never churned by read-only invocations.

Source

pub fn write_through_thread_checkout( &mut self, thread: &str, ) -> GitResult<WriteThroughOutcome>

Make the checkout’s real .git view agree with a specific Heddle thread. thread switch uses this after writing Heddle HEAD because resolving “current” through Git-overlay discovery can still see the branch that was active before the switch.

Source§

impl GitBridge<'_>

Source

pub fn reconstruction_repo(&mut self) -> GitResult<SleyRepository>

Open (initializing if necessary) a writable sley repo suitable for reconstruction’s tree-OID resolution. Any writable odb works — git trees are content-addressed — so the bridge’s own mirror is reused.

Source

pub fn reconstruct_commit_bytes( &self, repo: &SleyRepository, state: &State, ) -> GitResult<Vec<u8>>

Reconstruct the byte-exact commit content for state against repo (see reconstruct_commit_bytes), using the bridge’s import-built mapping for parent OIDs.

Source

pub fn reconstruct_and_write_commit( &self, repo: &SleyRepository, state: &State, ) -> GitResult<ObjectId>

Reconstruct state’s commit object from Heddle state and WRITE it into repo’s object database, returning its git OID (see write_commit_object). The export’s commit-minting step (#567): the object is regenerated from state, so it lands at the original SHA without the mirror needing to hold the verbatim bytes.

Source

pub fn reconstruct_commit_for_git_sha( &self, repo: &SleyRepository, sha: &str, ) -> GitResult<Option<Vec<u8>>>

Reconstruct the commit currently mapped to the git object sha (40-hex), or None if no Heddle state maps to it. Convenience for callers keyed by the original git OID — e.g. the #566 conformance gate, which compares the reconstruction of each original commit against its captured golden bytes.

Source

pub fn reconstruct_and_write_commit_for_git_sha( &self, repo: &SleyRepository, sha: &str, ) -> GitResult<Option<ObjectId>>

Reconstruct the commit mapped to git object sha and WRITE it into repo, returning the written OID (or None if no Heddle state maps to sha). Combines Self::reconstruct_commit_for_git_sha with the odb write so the #567 export-from-state path is exercisable against an arbitrary repo — notably a FRESH one that never received the verbatim imported bytes, which is how the export gate proves the object is regenerated from state, not copied from the mirror.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for GitBridge<'a>

§

impl<'a> !UnwindSafe for GitBridge<'a>

§

impl<'a> Freeze for GitBridge<'a>

§

impl<'a> Send for GitBridge<'a>

§

impl<'a> Sync for GitBridge<'a>

§

impl<'a> Unpin for GitBridge<'a>

§

impl<'a> UnsafeUnpin for GitBridge<'a>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more