Create a stash.
(repo_path: &Path, message: Option<&str>, include_untracked: bool)
| 658 | |
| 659 | /// Create a stash. |
| 660 | pub fn stash(repo_path: &Path, message: Option<&str>, include_untracked: bool) -> Result<()> { |
| 661 | let mut args = vec!["stash", "push"]; |
| 662 | if include_untracked { |
| 663 | args.push("-u"); |
| 664 | } |
| 665 | if let Some(msg) = message { |
| 666 | args.push("-m"); |
| 667 | args.push(msg); |
| 668 | } |
| 669 | |
| 670 | let (success, _, stderr) = run_git(repo_path, &args)?; |
| 671 | if !success { |
| 672 | return Err(anyhow!("Failed to stash: {}", stderr)); |
| 673 | } |
| 674 | Ok(()) |
| 675 | } |