mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-21 12:16:54 +02:00
minor rename
This commit is contained in:
parent
30a555b108
commit
2eee079d3a
@ -758,14 +758,14 @@ func (c *GitCommand) CheckRemoteBranchExists(branch *Branch) bool {
|
|||||||
return err == nil
|
return err == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Diff returns the diff of a file
|
// WorktreeFileDiff returns the diff of a file
|
||||||
func (c *GitCommand) Diff(file *File, plain bool, cached bool) string {
|
func (c *GitCommand) WorktreeFileDiff(file *File, plain bool, cached bool) string {
|
||||||
// for now we assume an error means the file was deleted
|
// for now we assume an error means the file was deleted
|
||||||
s, _ := c.OSCommand.RunCommandWithOutput(c.DiffCmdStr(file, plain, cached))
|
s, _ := c.OSCommand.RunCommandWithOutput(c.WorktreeFileDiffCmdStr(file, plain, cached))
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *GitCommand) DiffCmdStr(file *File, plain bool, cached bool) string {
|
func (c *GitCommand) WorktreeFileDiffCmdStr(file *File, plain bool, cached bool) string {
|
||||||
cachedArg := ""
|
cachedArg := ""
|
||||||
trackedArg := "--"
|
trackedArg := "--"
|
||||||
colorArg := c.colorArg()
|
colorArg := c.colorArg()
|
||||||
|
@ -1474,7 +1474,7 @@ func TestGitCommandDiff(t *testing.T) {
|
|||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
gitCmd := NewDummyGitCommand()
|
gitCmd := NewDummyGitCommand()
|
||||||
gitCmd.OSCommand.command = s.command
|
gitCmd.OSCommand.command = s.command
|
||||||
gitCmd.Diff(s.file, s.plain, s.cached)
|
gitCmd.WorktreeFileDiff(s.file, s.plain, s.cached)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ func (gui *Gui) selectFile(alreadySelected bool) error {
|
|||||||
return gui.refreshMergePanel()
|
return gui.refreshMergePanel()
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdStr := gui.GitCommand.DiffCmdStr(file, false, !file.HasUnstagedChanges && file.HasStagedChanges)
|
cmdStr := gui.GitCommand.WorktreeFileDiffCmdStr(file, false, !file.HasUnstagedChanges && file.HasStagedChanges)
|
||||||
cmd := gui.OSCommand.ExecutableFromString(cmdStr)
|
cmd := gui.OSCommand.ExecutableFromString(cmdStr)
|
||||||
|
|
||||||
refreshOpts := refreshMainOpts{main: &viewUpdateOpts{
|
refreshOpts := refreshMainOpts{main: &viewUpdateOpts{
|
||||||
@ -63,7 +63,7 @@ func (gui *Gui) selectFile(alreadySelected bool) error {
|
|||||||
}}
|
}}
|
||||||
|
|
||||||
if file.HasStagedChanges && file.HasUnstagedChanges {
|
if file.HasStagedChanges && file.HasUnstagedChanges {
|
||||||
cmdStr := gui.GitCommand.DiffCmdStr(file, false, true)
|
cmdStr := gui.GitCommand.WorktreeFileDiffCmdStr(file, false, true)
|
||||||
cmd := gui.OSCommand.ExecutableFromString(cmdStr)
|
cmd := gui.OSCommand.ExecutableFromString(cmdStr)
|
||||||
|
|
||||||
refreshOpts.secondary = &viewUpdateOpts{
|
refreshOpts.secondary = &viewUpdateOpts{
|
||||||
|
@ -43,8 +43,8 @@ func (gui *Gui) refreshStagingPanel(forceSecondaryFocused bool, selectedLineIdx
|
|||||||
}
|
}
|
||||||
|
|
||||||
// note for custom diffs, we'll need to send a flag here saying not to use the custom diff
|
// note for custom diffs, we'll need to send a flag here saying not to use the custom diff
|
||||||
diff := gui.GitCommand.Diff(file, true, secondaryFocused)
|
diff := gui.GitCommand.WorktreeFileDiff(file, true, secondaryFocused)
|
||||||
secondaryDiff := gui.GitCommand.Diff(file, true, !secondaryFocused)
|
secondaryDiff := gui.GitCommand.WorktreeFileDiff(file, true, !secondaryFocused)
|
||||||
|
|
||||||
// if we have e.g. a deleted file with nothing else to the diff will have only
|
// if we have e.g. a deleted file with nothing else to the diff will have only
|
||||||
// 4-5 lines in which case we'll swap panels
|
// 4-5 lines in which case we'll swap panels
|
||||||
|
Loading…
x
Reference in New Issue
Block a user