Skip to content

Commit 913d026

Browse files
Rename feature in config and default to false
1 parent 222f9a4 commit 913d026

File tree

7 files changed

+46
-50
lines changed

7 files changed

+46
-50
lines changed

docs/Config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ gui:
165165
showFileTree: true
166166

167167
# If true, show the number of lines changed per file in the Files view
168-
showNumberOfLineChanges: true
168+
showNumberOfLineChangesFilesView: false
169169

170170
# If true, show a random tip in the command log when Lazygit starts
171171
showRandomTip: true

pkg/commands/git_commands/config.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,3 @@ func (self *ConfigCommands) GetCoreCommentChar() byte {
111111
func (self *ConfigCommands) GetRebaseUpdateRefs() bool {
112112
return self.gitConfig.GetBool("rebase.updateRefs")
113113
}
114-
115-
func (cfgCommands *ConfigCommands) GetShowNumberOfLineChanges() bool {
116-
return cfgCommands.UserConfig().Gui.ShowNumberOfLineChanges
117-
}

pkg/commands/git_commands/file_loader.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212

1313
type FileLoaderConfig interface {
1414
GetShowUntrackedFiles() string
15-
GetShowNumberOfLineChanges() bool
1615
}
1716

1817
type FileLoader struct {
@@ -52,7 +51,7 @@ func (self *FileLoader) GetStatusFiles(opts GetStatusFileOptions) []*models.File
5251
files := []*models.File{}
5352

5453
fileDiffs := map[string]FileDiff{}
55-
if self.config.GetShowNumberOfLineChanges() {
54+
if self.GitCommon.Common.UserConfig().Gui.ShowNumberOfLineChangesFilesView {
5655
fileDiffs, err = self.getFileDiffs()
5756
if err != nil {
5857
self.Log.Error(err)

pkg/commands/git_commands/file_loader_test.go

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import (
1111

1212
func TestFileGetStatusFiles(t *testing.T) {
1313
type scenario struct {
14-
testName string
15-
similarityThreshold int
16-
runner oscommands.ICmdObjRunner
17-
showNumberOfLineChanges bool
18-
expectedFiles []*models.File
14+
testName string
15+
similarityThreshold int
16+
runner oscommands.ICmdObjRunner
17+
showNumberOfLineChangesFilesView bool
18+
expectedFiles []*models.File
1919
}
2020

2121
scenarios := []scenario{
@@ -38,7 +38,7 @@ func TestFileGetStatusFiles(t *testing.T) {
3838
"4\t1\tfile1.txt\x001\t0\tfile2.txt\x002\t2\tfile3.txt\x000\t2\tfile4.txt\x002\t2\tfile5.txt",
3939
nil,
4040
),
41-
showNumberOfLineChanges: true,
41+
showNumberOfLineChangesFilesView: true,
4242
expectedFiles: []*models.File{
4343
{
4444
Name: "file1.txt",
@@ -201,10 +201,16 @@ func TestFileGetStatusFiles(t *testing.T) {
201201
appState := &config.AppState{}
202202
appState.RenameSimilarityThreshold = s.similarityThreshold
203203

204+
userConfig := &config.UserConfig{
205+
Gui: config.GuiConfig{
206+
ShowNumberOfLineChangesFilesView: s.showNumberOfLineChangesFilesView,
207+
},
208+
}
209+
204210
loader := &FileLoader{
205-
GitCommon: buildGitCommon(commonDeps{appState: appState}),
211+
GitCommon: buildGitCommon(commonDeps{appState: appState, userConfig: userConfig}),
206212
cmd: cmd,
207-
config: &FakeFileLoaderConfig{showUntrackedFiles: "yes", showNumberOfLineChanges: s.showNumberOfLineChanges},
213+
config: &FakeFileLoaderConfig{showUntrackedFiles: "yes"},
208214
getFileType: func(string) string { return "file" },
209215
}
210216

@@ -214,14 +220,9 @@ func TestFileGetStatusFiles(t *testing.T) {
214220
}
215221

216222
type FakeFileLoaderConfig struct {
217-
showUntrackedFiles string
218-
showNumberOfLineChanges bool
223+
showUntrackedFiles string
219224
}
220225

221226
func (self *FakeFileLoaderConfig) GetShowUntrackedFiles() string {
222227
return self.showUntrackedFiles
223228
}
224-
225-
func (self *FakeFileLoaderConfig) GetShowNumberOfLineChanges() bool {
226-
return self.showNumberOfLineChanges
227-
}

pkg/config/user_config.go

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ type GuiConfig struct {
110110
// This can be toggled from within Lazygit with the '~' key, but that will not change the default.
111111
ShowFileTree bool `yaml:"showFileTree"`
112112
// If true, show the number of lines changed per file in the Files view
113-
ShowNumberOfLineChanges bool `yaml:"showNumberOfLineChanges"`
113+
ShowNumberOfLineChangesFilesView bool `yaml:"showNumberOfLineChangesFilesView"`
114114
// If true, show a random tip in the command log when Lazygit starts
115115
ShowRandomTip bool `yaml:"showRandomTip"`
116116
// If true, show the command log
@@ -707,31 +707,31 @@ func GetDefaultConfig() *UserConfig {
707707
UnstagedChangesColor: []string{"red"},
708708
DefaultFgColor: []string{"default"},
709709
},
710-
CommitLength: CommitLengthConfig{Show: true},
711-
SkipNoStagedFilesWarning: false,
712-
ShowListFooter: true,
713-
ShowCommandLog: true,
714-
ShowBottomLine: true,
715-
ShowPanelJumps: true,
716-
ShowFileTree: true,
717-
ShowNumberOfLineChanges: true,
718-
ShowRandomTip: true,
719-
ShowIcons: false,
720-
NerdFontsVersion: "",
721-
ShowFileIcons: true,
722-
CommitAuthorShortLength: 2,
723-
CommitAuthorLongLength: 17,
724-
CommitHashLength: 8,
725-
ShowBranchCommitHash: false,
726-
ShowDivergenceFromBaseBranch: "none",
727-
CommandLogSize: 8,
728-
SplitDiff: "auto",
729-
SkipRewordInEditorWarning: false,
730-
WindowSize: "normal",
731-
Border: "rounded",
732-
AnimateExplosion: true,
733-
PortraitMode: "auto",
734-
FilterMode: "substring",
710+
CommitLength: CommitLengthConfig{Show: true},
711+
SkipNoStagedFilesWarning: false,
712+
ShowListFooter: true,
713+
ShowCommandLog: true,
714+
ShowBottomLine: true,
715+
ShowPanelJumps: true,
716+
ShowFileTree: true,
717+
ShowNumberOfLineChangesFilesView: false,
718+
ShowRandomTip: true,
719+
ShowIcons: false,
720+
NerdFontsVersion: "",
721+
ShowFileIcons: true,
722+
CommitAuthorShortLength: 2,
723+
CommitAuthorLongLength: 17,
724+
CommitHashLength: 8,
725+
ShowBranchCommitHash: false,
726+
ShowDivergenceFromBaseBranch: "none",
727+
CommandLogSize: 8,
728+
SplitDiff: "auto",
729+
SkipRewordInEditorWarning: false,
730+
WindowSize: "normal",
731+
Border: "rounded",
732+
AnimateExplosion: true,
733+
PortraitMode: "auto",
734+
FilterMode: "substring",
735735
Spinner: SpinnerConfig{
736736
Frames: []string{"|", "/", "-", "\\"},
737737
Rate: 50,

pkg/gui/context/working_tree_context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func NewWorkingTreeContext(c *ContextCommon) *WorkingTreeContext {
3030

3131
getDisplayStrings := func(_ int, _ int) [][]string {
3232
showFileIcons := icons.IsIconEnabled() && c.UserConfig().Gui.ShowFileIcons
33-
showNumberOfLineChanges := c.UserConfig().Gui.ShowNumberOfLineChanges
33+
showNumberOfLineChanges := c.UserConfig().Gui.ShowNumberOfLineChangesFilesView
3434
lines := presentation.RenderFileTree(viewModel, c.Model().Submodules, showFileIcons, showNumberOfLineChanges)
3535
return lo.Map(lines, func(line string, _ int) []string {
3636
return []string{line}

schema/config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,10 @@
293293
"description": "If true, display the files in the file views as a tree. If false, display the files as a flat list.\nThis can be toggled from within Lazygit with the '~' key, but that will not change the default.",
294294
"default": true
295295
},
296-
"showNumberOfLineChanges": {
296+
"showNumberOfLineChangesFilesView": {
297297
"type": "boolean",
298298
"description": "If true, show the number of lines changed per file in the Files view",
299-
"default": true
299+
"default": false
300300
},
301301
"showRandomTip": {
302302
"type": "boolean",

0 commit comments

Comments
 (0)