mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 20:54:59 +00:00
feature: add option to enable --keep-index
option of git stash push
command (#610)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
3e6e0befaa
commit
566d36ca59
6 changed files with 22 additions and 5 deletions
|
@ -17,17 +17,19 @@ namespace SourceGit.Commands
|
|||
return Exec();
|
||||
}
|
||||
|
||||
public bool Push(List<Models.Change> changes, string message, bool onlyStaged)
|
||||
public bool Push(List<Models.Change> changes, string message, bool onlyStaged, bool keepIndex)
|
||||
{
|
||||
var pathsBuilder = new StringBuilder();
|
||||
|
||||
var indexOpts = keepIndex ? "--keep-index" : "";
|
||||
|
||||
if (onlyStaged)
|
||||
{
|
||||
foreach (var c in changes)
|
||||
pathsBuilder.Append($"\"{c.Path}\" ");
|
||||
|
||||
var paths = pathsBuilder.ToString();
|
||||
Args = $"stash push --staged -m \"{message}\" -- {paths}";
|
||||
Args = $"stash push {indexOpts} --staged -m \"{message}\" -- {paths}";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -53,7 +55,7 @@ namespace SourceGit.Commands
|
|||
}
|
||||
|
||||
var paths = pathsBuilder.ToString();
|
||||
Args = $"stash push -m \"{message}\" -- {paths}";
|
||||
Args = $"stash push {indexOpts} -m \"{message}\" -- {paths}";
|
||||
}
|
||||
|
||||
return Exec();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue