mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 12:45:00 +00:00
refactor: re-implement git stash apply
* supports `--index` option * add an option to drop selected stash after applying * remove `Pop` context menu for stash Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
dbb1df5f8b
commit
7089f29b85
9 changed files with 121 additions and 22 deletions
|
@ -73,27 +73,22 @@ namespace SourceGit.Commands
|
|||
return Exec();
|
||||
}
|
||||
|
||||
public bool Apply(string name = null)
|
||||
public bool Apply(string name, bool restoreIndex)
|
||||
{
|
||||
Args = "stash apply -q";
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
Args += $" \"{name}\"";
|
||||
var opts = restoreIndex ? "--index" : string.Empty;
|
||||
Args = $"stash apply -q {opts} \"{name}\"";
|
||||
return Exec();
|
||||
}
|
||||
|
||||
public bool Pop(string name = null)
|
||||
public bool Pop(string name)
|
||||
{
|
||||
Args = "stash pop -q";
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
Args += $" \"{name}\"";
|
||||
Args = $"stash pop -q \"{name}\"";
|
||||
return Exec();
|
||||
}
|
||||
|
||||
public bool Drop(string name = null)
|
||||
public bool Drop(string name)
|
||||
{
|
||||
Args = "stash drop -q";
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
Args += $" \"{name}\"";
|
||||
Args = $"stash drop -q \"{name}\"";
|
||||
return Exec();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue