List stashes.
(repo_path: &Path)
| 636 | |
| 637 | /// List stashes. |
| 638 | pub 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. |
| 660 | pub fn stash(repo_path: &Path, message: Option<&str>, include_untracked: bool) -> Result<()> { |
no test coverage detected