MCPcopy Index your code
hub / github.com/AI45Lab/Code / list_stashes

Function list_stashes

core/src/git.rs:638–657  ·  view source on GitHub ↗

List stashes.

(repo_path: &Path)

Source from the content-addressed store, hash-verified

636
637/// List stashes.
638pub fn list_stashes(repo_path: &Path) -> Result<Vec<StashInfo>> {
639 let (_, stdout, _) = run_git(repo_path, &["stash", "list", "--format=%H|%gd|%s"])?;
640
641 let stashes: Vec<StashInfo> = stdout
642 .lines()
643 .filter_map(|line| {
644 let parts: Vec<&str> = line.splitn(3, '|').collect();
645 if parts.len() >= 3 {
646 Some(StashInfo {
647 index: parts[1].parse().unwrap_or(0),
648 message: parts[2].to_string(),
649 })
650 } else {
651 None
652 }
653 })
654 .collect();
655
656 Ok(stashes)
657}
658
659/// Create a stash.
660pub fn stash(repo_path: &Path, message: Option<&str>, include_untracked: bool) -> Result<()> {

Callers 1

list_stashesMethod · 0.85

Calls 3

run_gitFunction · 0.85
lenMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected