Add option --ignore-whitespace supports for git apply command

This commit is contained in:
leo 2020-07-08 11:37:29 +08:00
parent 95030c334f
commit 5df377e48e
3 changed files with 23 additions and 6 deletions

View file

@ -502,11 +502,16 @@ namespace SourceGit.Git {
/// Apply patch.
/// </summary>
/// <param name="patch"></param>
/// <param name="ignoreSpaceChanges"></param>
/// <param name="whitespaceMode"></param>
public void Apply(string patch, string whitespaceMode) {
public void Apply(string patch, bool ignoreSpaceChanges, string whitespaceMode) {
isWatcherDisabled = true;
var errs = RunCommand($"apply --whitespace={whitespaceMode} \"{patch}\"", null);
var args = "apply ";
if (ignoreSpaceChanges) args += "--ignore-whitespace ";
else args += $"--whitespace={whitespaceMode} ";
var errs = RunCommand($"{args} \"{patch}\"", null);
if (errs != null) {
App.RaiseError(errs);
} else {