This is for generating diffs to be shown in the UI (e.g. rendering a range diff to the main view). It uses a custom pager if one is configured.
(diffArgs []string)
| 19 | // This is for generating diffs to be shown in the UI (e.g. rendering a range |
| 20 | // diff to the main view). It uses a custom pager if one is configured. |
| 21 | func (self *DiffCommands) DiffCmdObj(diffArgs []string) *oscommands.CmdObj { |
| 22 | extDiffCmd := self.pagerConfig.GetExternalDiffCommand() |
| 23 | useExtDiff := extDiffCmd != "" |
| 24 | useExtDiffGitConfig := self.pagerConfig.GetUseExternalDiffGitConfig() |
| 25 | ignoreWhitespace := self.UserConfig().Git.IgnoreWhitespaceInDiffView |
| 26 | |
| 27 | return self.cmd.New( |
| 28 | NewGitCmd("diff"). |
| 29 | Config("diff.noprefix=false"). |
| 30 | ConfigIf(useExtDiff, "diff.external="+extDiffCmd). |
| 31 | ArgIfElse(useExtDiff || useExtDiffGitConfig, "--ext-diff", "--no-ext-diff"). |
| 32 | Arg("--submodule"). |
| 33 | Arg(fmt.Sprintf("--color=%s", self.pagerConfig.GetColorArg())). |
| 34 | ArgIf(ignoreWhitespace, "--ignore-all-space"). |
| 35 | Arg(fmt.Sprintf("--unified=%d", self.UserConfig().Git.DiffContextSize)). |
| 36 | Arg(diffArgs...). |
| 37 | Dir(self.repoPaths.worktreePath). |
| 38 | ToArgv(), |
| 39 | ) |
| 40 | } |
| 41 | |
| 42 | // This is a basic generic diff command that can be used for any diff operation |
| 43 | // (e.g. copying a diff to the clipboard). It will not use a custom pager, and |
no test coverage detected