diff --git a/pkg/commands/git_commands/diff.go b/pkg/commands/git_commands/diff.go index 8eb4799b6..aecd66920 100644 --- a/pkg/commands/git_commands/diff.go +++ b/pkg/commands/git_commands/diff.go @@ -19,6 +19,7 @@ func NewDiffCommands(gitCommon *GitCommon) *DiffCommands { func (self *DiffCommands) DiffCmdObj(diffArgs []string) oscommands.ICmdObj { extDiffCmd := self.UserConfig().Git.Paging.ExternalDiffCommand useExtDiff := extDiffCmd != "" + ignoreWhitespace := self.AppState.IgnoreWhitespaceInDiffView return self.cmd.New( NewGitCmd("diff"). @@ -27,6 +28,7 @@ func (self *DiffCommands) DiffCmdObj(diffArgs []string) oscommands.ICmdObj { ArgIfElse(useExtDiff, "--ext-diff", "--no-ext-diff"). Arg("--submodule"). Arg(fmt.Sprintf("--color=%s", self.UserConfig().Git.Paging.ColorArg)). + ArgIf(ignoreWhitespace, "--ignore-all-space"). Arg(diffArgs...). Dir(self.repoPaths.worktreePath). ToArgv(), diff --git a/pkg/gui/controllers/helpers/diff_helper.go b/pkg/gui/controllers/helpers/diff_helper.go index 0a8c85aa9..2eda84fc1 100644 --- a/pkg/gui/controllers/helpers/diff_helper.go +++ b/pkg/gui/controllers/helpers/diff_helper.go @@ -34,10 +34,6 @@ func (self *DiffHelper) DiffArgs() []string { output = append(output, "-R") } - if self.c.GetAppState().IgnoreWhitespaceInDiffView { - output = append(output, "--ignore-all-space") - } - output = append(output, "--") file := self.currentlySelectedFilename() @@ -59,9 +55,6 @@ func (self *DiffHelper) GetUpdateTaskForRenderingCommitsDiff(commit *models.Comm if refRange != nil { from, to := refRange.From, refRange.To args := []string{from.ParentRefName(), to.RefName(), "--stat", "-p"} - if self.c.GetAppState().IgnoreWhitespaceInDiffView { - args = append(args, "--ignore-all-space") - } args = append(args, "--") if path := self.c.Modes().Filtering.GetPath(); path != "" { args = append(args, path)