outpost-core 0.1.3

Core library for Git Outpost, a clone-backed alternative to git worktree workflows.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::path::PathBuf;

use crate::selector::{OutpostSelector, resolve_live_entry};
use crate::{OutpostResult, SourceRepo};

pub struct LockOptions {
    pub selector: OutpostSelector,
    pub reason: Option<String>,
}

pub fn run(source: &SourceRepo, opts: LockOptions) -> OutpostResult<PathBuf> {
    let resolved = resolve_live_entry(source, &opts.selector)?;
    let mut registry = source.registry_mut()?;
    registry.lock(&resolved.path, opts.reason)?;
    registry.save()?;
    Ok(resolved.path)
}