Allow for staging and unstaging in git management view
This commit is contained in:
parent
a481bb342d
commit
4716c2242b
4 changed files with 293 additions and 180 deletions
19
src/git.rs
19
src/git.rs
|
|
@ -262,4 +262,23 @@ impl GitRepository {
|
|||
|
||||
Ok(status)
|
||||
}
|
||||
|
||||
pub async fn stage<P: AsRef<Path>>(&self, path: P) -> io::Result<()> {
|
||||
let path = path.as_ref();
|
||||
let mut command = self.command();
|
||||
command.arg("stage");
|
||||
command.arg("--").arg(path);
|
||||
Self::command_stdout(command).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn unstage<P: AsRef<Path>>(&self, path: P) -> io::Result<()> {
|
||||
let path = path.as_ref();
|
||||
let mut command = self.command();
|
||||
command.arg("restore");
|
||||
command.arg("--staged");
|
||||
command.arg("--").arg(path);
|
||||
Self::command_stdout(command).await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue