MCPcopy
hub / github.com/jesseduffield/lazygit / ShowCmdObj

Method ShowCmdObj

pkg/commands/git_commands/commit.go:243–267  ·  view source on GitHub ↗
(hash string, filterPaths []string)

Source from the content-addressed store, hash-verified

241}
242
243func (self *CommitCommands) ShowCmdObj(hash string, filterPaths []string) *oscommands.CmdObj {
244 contextSize := self.UserConfig().Git.DiffContextSize
245
246 extDiffCmd := self.pagerConfig.GetExternalDiffCommand()
247 useExtDiffGitConfig := self.pagerConfig.GetUseExternalDiffGitConfig()
248 cmdArgs := NewGitCmd("show").
249 Config("diff.noprefix=false").
250 ConfigIf(extDiffCmd != "", "diff.external="+extDiffCmd).
251 ArgIfElse(extDiffCmd != "" || useExtDiffGitConfig, "--ext-diff", "--no-ext-diff").
252 Arg("--submodule").
253 Arg("--color="+self.pagerConfig.GetColorArg()).
254 Arg(fmt.Sprintf("--unified=%d", contextSize)).
255 Arg("--stat").
256 Arg("--decorate").
257 Arg("-p").
258 Arg(hash).
259 ArgIf(self.UserConfig().Git.IgnoreWhitespaceInDiffView, "--ignore-all-space").
260 Arg(fmt.Sprintf("--find-renames=%d%%", self.UserConfig().Git.RenameSimilarityThreshold)).
261 Arg("--").
262 Arg(filterPaths...).
263 Dir(self.repoPaths.worktreePath).
264 ToArgv()
265
266 return self.cmd.New(cmdArgs).DontLog()
267}
268
269func (self *CommitCommands) ShowFileContentCmdObj(hash string, filePath string) *oscommands.CmdObj {
270 cmdArgs := NewGitCmd("show").

Callers 3

TestCommitShowCmdObjFunction · 0.80
GetOnRenderToMainMethod · 0.80

Calls 15

NewGitCmdFunction · 0.85
UserConfigMethod · 0.80
ToArgvMethod · 0.80
DirMethod · 0.80
ArgMethod · 0.80
ArgIfMethod · 0.80
ArgIfElseMethod · 0.80
ConfigIfMethod · 0.80
GetColorArgMethod · 0.80
DontLogMethod · 0.80

Tested by 1

TestCommitShowCmdObjFunction · 0.64