From a2318d75b5a81aba6f79ffbd76c8a602121ac20c Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sun, 23 Jan 2022 14:40:28 +1100 Subject: [PATCH] fix some things --- docs/keybindings/Keybindings_en.md | 29 +- docs/keybindings/Keybindings_nl.md | 21 +- docs/keybindings/Keybindings_pl.md | 29 +- docs/keybindings/Keybindings_zh.md | 29 +- go.mod | 2 - go.sum | 3 - pkg/gui/context_config.go | 2 +- pkg/gui/context_test.go | 11 +- pkg/gui/controllers/bisect_controller.go | 20 +- pkg/gui/controllers/files_controller.go | 97 +++--- .../controllers/local_commits_controller.go | 38 +-- pkg/gui/controllers/menu_controller.go | 14 +- pkg/gui/controllers/remotes_controller.go | 26 +- pkg/gui/controllers/tags_controller.go | 20 +- pkg/gui/diff_context_size_test.go | 313 +++++++++--------- pkg/gui/files_panel.go | 18 +- pkg/gui/gui.go | 40 ++- pkg/gui/keybindings.go | 2 +- pkg/gui/list_context.go | 1 + pkg/gui/misc.go | 6 + pkg/gui/popup/popup_handler.go | 4 +- pkg/gui/ref_helper.go | 24 +- pkg/gui/suggestions_helper.go | 24 +- pkg/gui/working_tree_helper.go | 12 +- pkg/i18n/chinese.go | 1 - pkg/i18n/dutch.go | 1 - pkg/i18n/english.go | 2 - pkg/i18n/polish.go | 1 - .../mergeConflictsFiltered/test.json | 2 +- vendor/modules.txt | 3 - 30 files changed, 367 insertions(+), 428 deletions(-) diff --git a/docs/keybindings/Keybindings_en.md b/docs/keybindings/Keybindings_en.md index 09a933f81..82eafdb1d 100644 --- a/docs/keybindings/Keybindings_en.md +++ b/docs/keybindings/Keybindings_en.md @@ -10,21 +10,20 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct pgdown: scroll down main panel (fn+down) m: view merge/rebase options ctrl+p: view custom patch options - P: push - p: pull R: refresh x: open menu - z: undo (via reflog) (experimental) - ctrl+z: redo (via reflog) (experimental) +: next screen mode (normal/half/fullscreen) _: prev screen mode - :: execute custom command ctrl+s: view filter-by-path options W: open diff menu ctrl+e: open diff menu @: open command log menu }: Increase the size of the context shown around changes in the diff view {: Decrease the size of the context shown around changes in the diff view + z: undo (via reflog) (experimental) + ctrl+z: redo (via reflog) (experimental) + P: push + p: pull ## List Panel Navigation @@ -170,20 +169,20 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct @: open command log menu -## Files Panel - -
-  ctrl+b: Filter commit files
-
- ## Files Panel (Files)
+  d: view 'discard changes' options
+  D: view reset options
+  f: fetch
+  ctrl+o: copy the file name to the clipboard
+  ctrl+w: Toggle whether or not whitespace changes are shown in the diff view
+  space: toggle staged
+  ctrl+b: Filter files (staged/unstaged)
   c: commit changes
   w: commit changes without pre-commit hook
   A: amend last commit
   C: commit changes using git editor
-  d: view 'discard changes' options
   e: edit file
   o: open file
   i: add to .gitignore
@@ -191,15 +190,11 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
   s: stash changes
   S: view stash options
   a: stage/unstage all
-  D: view reset options
   enter: stage individual hunks/lines for file, or collapse/expand for directory
-  f: fetch
-  ctrl+o: copy the file name to the clipboard
+  :: execute custom command
   g: view upstream reset options
   `: toggle file tree view
   M: open external merge tool (git mergetool)
-  ctrl+w: Toggle whether or not whitespace changes are shown in the diff view
-  space: toggle staged
 
## Files Panel (Submodules) diff --git a/docs/keybindings/Keybindings_nl.md b/docs/keybindings/Keybindings_nl.md index 5e0d62fac..0136a529b 100644 --- a/docs/keybindings/Keybindings_nl.md +++ b/docs/keybindings/Keybindings_nl.md @@ -10,12 +10,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct pgdown: scroll naar beneden vanaf hoofdpaneel (fn+down) m: bekijk merge/rebase opties ctrl+p: bekijk aangepaste patch opties - P: push - p: pull R: verversen x: open menu - z: ongedaan maken (via reflog) (experimenteel) - ctrl+z: redo (via reflog) (experimenteel) +: volgende scherm modus (normaal/half/groot) _: vorige scherm modus :: voer aangepaste commando uit @@ -25,6 +21,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct @: open command log menu }: Increase the size of the context shown around changes in the diff view {: Decrease the size of the context shown around changes in the diff view + z: ongedaan maken (via reflog) (experimenteel) + ctrl+z: redo (via reflog) (experimenteel) + P: push + p: pull ## Lijstpaneel Navigatie @@ -170,12 +170,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct @: open command log menu -## Bestanden Paneel - -
-  ctrl+b: Commit dossiers filteren
-
- ## Bestanden Paneel (Bestanden)
@@ -183,7 +177,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
   w: commit veranderingen zonder pre-commit hook
   A: wijzig laatste commit
   C: commit veranderingen met de git editor
-  d: bekijk 'veranderingen ongedaan maken' opties
   e: verander bestand
   o: open bestand
   i: voeg toe aan .gitignore
@@ -191,15 +184,11 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
   s: stash-bestanden
   S: bekijk stash opties
   a: toggle staged alle
-  D: bekijk reset opties
   enter: stage individuele hunks/lijnen
-  f: fetch
-  ctrl+o: kopieer de bestandsnaam naar het klembord
+  :: voor aangepaste commando uit
   g: bekijk upstream reset opties
   `: toggle bestandsboom weergave
   M: open external merge tool (git mergetool)
-  ctrl+w: Toggle whether or not whitespace changes are shown in the diff view
-  space: toggle staged
 
## Bestanden Paneel (Submodules) diff --git a/docs/keybindings/Keybindings_pl.md b/docs/keybindings/Keybindings_pl.md index afdcdebcd..1d7f4f725 100644 --- a/docs/keybindings/Keybindings_pl.md +++ b/docs/keybindings/Keybindings_pl.md @@ -10,21 +10,20 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct pgdown: scroll down main panel (fn+down) m: widok scalenia/opcje zmiany bazy ctrl+p: view custom patch options - P: push - p: pull R: odśwież x: open menu - z: undo (via reflog) (experimental) - ctrl+z: redo (via reflog) (experimental) +: next screen mode (normal/half/fullscreen) _: prev screen mode - :: wykonaj własną komendę ctrl+s: view filter-by-path options W: open diff menu ctrl+e: open diff menu @: open command log menu }: Increase the size of the context shown around changes in the diff view {: Decrease the size of the context shown around changes in the diff view + z: undo (via reflog) (experimental) + ctrl+z: redo (via reflog) (experimental) + P: push + p: pull ## List Panel Navigation @@ -170,20 +169,20 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct @: open command log menu -## Pliki Panel - -
-  ctrl+b: Filtrowanie commitów
-
- ## Pliki Panel (Pliki)
+  d: pokaż opcje porzucania zmian
+  D: wyświetl opcje resetu
+  f: pobierz
+  ctrl+o: copy the file name to the clipboard
+  ctrl+w: Toggle whether or not whitespace changes are shown in the diff view
+  space: przełącz stan poczekalni
+  ctrl+b: Filter files (staged/unstaged)
   c: Zatwierdź zmiany
   w: zatwierdź zmiany bez skryptu pre-commit
   A: Zmień ostatni commit
   C: Zatwierdź zmiany używając edytora
-  d: pokaż opcje porzucania zmian
   e: edytuj plik
   o: otwórz plik
   i: dodaj do .gitignore
@@ -191,15 +190,11 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
   s: przechowaj zmiany
   S: wyświetl opcje schowka
   a: przełącz stan poczekalni wszystkich
-  D: wyświetl opcje resetu
   enter: zatwierdź pojedyncze linie
-  f: pobierz
-  ctrl+o: copy the file name to the clipboard
+  :: wykonaj własną komendę
   g: view upstream reset options
   `: toggle file tree view
   M: open external merge tool (git mergetool)
-  ctrl+w: Toggle whether or not whitespace changes are shown in the diff view
-  space: przełącz stan poczekalni
 
## Pliki Panel (Submodules) diff --git a/docs/keybindings/Keybindings_zh.md b/docs/keybindings/Keybindings_zh.md index 61b2c287f..cba13cfc4 100644 --- a/docs/keybindings/Keybindings_zh.md +++ b/docs/keybindings/Keybindings_zh.md @@ -10,21 +10,20 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct pgdown: 向下滚动主面板 (fn+down) m: 查看 合并/变基 选项 ctrl+p: 查看自定义补丁选项 - P: 推送 - p: 拉取 R: 刷新 x: 打开菜单 - z: (通过 reflog)撤销「实验功能」 - ctrl+z: (通过 reflog)重做「实验功能」 +: 下一屏模式(正常/半屏/全屏) _: 上一屏模式 - :: 执行自定义命令 ctrl+s: 查看按路径过滤选项 W: 打开 diff 菜单 ctrl+e: 打开 diff 菜单 @: 打开命令日志菜单 }: Increase the size of the context shown around changes in the diff view {: Decrease the size of the context shown around changes in the diff view + z: (通过 reflog)撤销「实验功能」 + ctrl+z: (通过 reflog)重做「实验功能」 + P: 推送 + p: 拉取 ## 列表面板导航 @@ -170,20 +169,20 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct @: 打开命令日志菜单 -## 文件 面板 - -
-  ctrl+b: 过滤提交文件
-
- ## 文件 面板 (文件)
+  d: 查看'放弃更改‘选项
+  D: 查看重置选项
+  f: 抓取
+  ctrl+o: 将文件名复制到剪贴板
+  ctrl+w: 切换是否在差异视图中显示空白更改
+  space: 切换暂存状态
+  ctrl+b: Filter files (staged/unstaged)
   c: 提交更改
   w: 提交更改而无需预先提交钩子
   A: 修补最后一次提交
   C: 提交更改(使用编辑器编辑提交信息)
-  d: 查看'放弃更改‘选项
   e: 编辑文件
   o: 打开文件
   i: 添加到 .gitignore
@@ -191,15 +190,11 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
   s: 将所有更改加入贮藏
   S: 查看隐藏选项
   a: 切换所有文件的暂存状态
-  D: 查看重置选项
   enter: 暂存单个 块/行 用于文件, 或 折叠/展开 目录
-  f: 抓取
-  ctrl+o: 将文件名复制到剪贴板
+  :: 执行自定义命令
   g: 查看上游重置选项
   `: 切换文件树视图
   M: 打开合并工具
-  ctrl+w: 切换是否在差异视图中显示空白更改
-  space: 切换暂存状态
 
## 文件 面板 (子模块) diff --git a/go.mod b/go.mod index 6d72ea3b8..f4f67183d 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,6 @@ require ( github.com/gdamore/tcell/v2 v2.4.1-0.20220313203054-2a1a1b586447 // indirect github.com/go-errors/errors v1.4.1 github.com/go-logfmt/logfmt v0.5.0 // indirect - github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 // indirect github.com/golang/protobuf v1.3.2 // indirect github.com/google/go-cmp v0.5.6 // indirect github.com/gookit/color v1.4.2 @@ -45,6 +44,5 @@ require ( golang.org/x/net v0.0.0-20201002202402-0a1ea396d57c // indirect golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect - golang.org/x/text v0.3.7 // indirect gopkg.in/ozeidan/fuzzy-patricia.v3 v3.0.0 ) diff --git a/go.sum b/go.sum index fe2bffe74..e0e58cd81 100644 --- a/go.sum +++ b/go.sum @@ -33,7 +33,6 @@ github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko= github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= -github.com/gdamore/tcell/v2 v2.4.0 h1:W6dxJEmaxYvhICFoTY3WrLLEXsQ11SaFnKGVEXW57KM= github.com/gdamore/tcell/v2 v2.4.0/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU= github.com/gdamore/tcell/v2 v2.4.1-0.20210926162909-66f061b1fc9b h1:eoaSI4eEwM5eTx/HvmRSwmicxuMhL73AyoEfM1oCJLc= github.com/gdamore/tcell/v2 v2.4.1-0.20210926162909-66f061b1fc9b/go.mod h1:ZPwXnysybtQqdqKcWMWXux9aGdtMHe+kr+cwEZEe+A4= @@ -55,8 +54,6 @@ github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 h1:zN2lZNZRflqFyxVaTIU61KNKQ9C0055u9CAfpmqUvo4= -github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3/go.mod h1:nPpo7qLxd6XL3hWJG/O60sR8ZKfMCiIoNap5GvD12KU= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= diff --git a/pkg/gui/context_config.go b/pkg/gui/context_config.go index b3e94e15f..b27514381 100644 --- a/pkg/gui/context_config.go +++ b/pkg/gui/context_config.go @@ -145,7 +145,7 @@ func (gui *Gui) contextTree() context.ContextTree { }, Merging: &BasicContext{ OnFocus: OnFocusWrapper(func() error { return gui.renderConflictsWithLock(true) }), - Kind: MAIN_CONTEXT, + Kind: types.MAIN_CONTEXT, ViewName: "main", Key: MAIN_MERGING_CONTEXT_KEY, OnGetOptionsMap: gui.getMergingOptions, diff --git a/pkg/gui/context_test.go b/pkg/gui/context_test.go index 7f03f7484..3a0aa120a 100644 --- a/pkg/gui/context_test.go +++ b/pkg/gui/context_test.go @@ -4,15 +4,16 @@ import ( "testing" "github.com/jesseduffield/gocui" + "github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/stretchr/testify/assert" ) func TestCanDeactivatePopupContextsWithoutViews(t *testing.T) { - contexts := []func(gui *Gui) Context{ - func(gui *Gui) Context { return gui.State.Contexts.Credentials }, - func(gui *Gui) Context { return gui.State.Contexts.Confirmation }, - func(gui *Gui) Context { return gui.State.Contexts.CommitMessage }, - func(gui *Gui) Context { return gui.State.Contexts.Search }, + contexts := []func(gui *Gui) types.Context{ + func(gui *Gui) types.Context { return gui.State.Contexts.Credentials }, + func(gui *Gui) types.Context { return gui.State.Contexts.Confirmation }, + func(gui *Gui) types.Context { return gui.State.Contexts.CommitMessage }, + func(gui *Gui) types.Context { return gui.State.Contexts.Search }, } for _, c := range contexts { diff --git a/pkg/gui/controllers/bisect_controller.go b/pkg/gui/controllers/bisect_controller.go index 674e79f76..06602a445 100644 --- a/pkg/gui/controllers/bisect_controller.go +++ b/pkg/gui/controllers/bisect_controller.go @@ -13,9 +13,9 @@ import ( ) type BisectController struct { - c *ControllerCommon - context types.IListContext - git *commands.GitCommand + c *ControllerCommon + getContext func() types.IListContext + git *commands.GitCommand getSelectedLocalCommit func() *models.Commit getCommits func() []*models.Commit @@ -25,16 +25,16 @@ var _ types.IController = &BisectController{} func NewBisectController( c *ControllerCommon, - context types.IListContext, + getContext func() types.IListContext, git *commands.GitCommand, getSelectedLocalCommit func() *models.Commit, getCommits func() []*models.Commit, ) *BisectController { return &BisectController{ - c: c, - context: context, - git: git, + c: c, + getContext: getContext, + git: git, getSelectedLocalCommit: getSelectedLocalCommit, getCommits: getCommits, @@ -249,8 +249,8 @@ func (self *BisectController) selectCurrentBisectCommit() { // find index of commit with that sha, move cursor to that. for i, commit := range self.getCommits() { if commit.Sha == info.GetCurrentSha() { - self.context.GetPanelState().SetSelectedLineIdx(i) - _ = self.context.HandleFocus() + self.getContext().GetPanelState().SetSelectedLineIdx(i) + _ = self.getContext().HandleFocus() break } } @@ -269,5 +269,5 @@ func (self *BisectController) checkSelected(callback func(*models.Commit) error) } func (self *BisectController) Context() types.Context { - return self.context + return self.getContext() } diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index 10d378f9f..8f4641147 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -22,14 +22,14 @@ type FilesController struct { // case I would actually prefer a _zero_ letter variable name in the form of // struct embedding, but Go does not allow hiding public fields in an embedded struct // to the client - c *ControllerCommon - context types.IListContext - git *commands.GitCommand - os *oscommands.OSCommand + c *ControllerCommon + getContext func() types.IListContext + git *commands.GitCommand + os *oscommands.OSCommand getSelectedFileNode func() *filetree.FileNode - allContexts context.ContextTree - fileTreeViewModel *filetree.FileTreeViewModel + getContexts func() context.ContextTree + getViewModel func() *filetree.FileTreeViewModel enterSubmodule func(submodule *models.SubmoduleConfig) error getSubmodules func() []*models.SubmoduleConfig setCommitMessage func(message string) @@ -49,12 +49,12 @@ var _ types.IController = &FilesController{} func NewFilesController( c *ControllerCommon, - context types.IListContext, + getContext func() types.IListContext, git *commands.GitCommand, os *oscommands.OSCommand, getSelectedFileNode func() *filetree.FileNode, - allContexts context.ContextTree, - fileTreeViewModel *filetree.FileTreeViewModel, + allContexts func() context.ContextTree, + getViewModel func() *filetree.FileTreeViewModel, enterSubmodule func(submodule *models.SubmoduleConfig) error, getSubmodules func() []*models.SubmoduleConfig, setCommitMessage func(message string), @@ -70,12 +70,12 @@ func NewFilesController( ) *FilesController { return &FilesController{ c: c, - context: context, + getContext: getContext, git: git, os: os, getSelectedFileNode: getSelectedFileNode, - allContexts: allContexts, - fileTreeViewModel: fileTreeViewModel, + getContexts: allContexts, + getViewModel: getViewModel, enterSubmodule: enterSubmodule, getSubmodules: getSubmodules, setCommitMessage: setCommitMessage, @@ -100,7 +100,7 @@ func (self *FilesController) Keybindings(getKey func(key string) interface{}, co }, { Key: gocui.MouseLeft, - Handler: func() error { return self.context.HandleClick(self.checkSelectedFileNode(self.press)) }, + Handler: func() error { return self.getContext().HandleClick(self.checkSelectedFileNode(self.press)) }, }, { Key: getKey(""), // TODO: softcode @@ -129,7 +129,7 @@ func (self *FilesController) Keybindings(getKey func(key string) interface{}, co }, { Key: getKey(config.Universal.Edit), - Handler: self.edit, + Handler: self.checkSelectedFileNode(self.edit), Description: self.c.Tr.LcEditFile, }, { @@ -139,7 +139,7 @@ func (self *FilesController) Keybindings(getKey func(key string) interface{}, co }, { Key: getKey(config.Files.IgnoreFile), - Handler: self.ignore, + Handler: self.checkSelectedFileNode(self.ignore), Description: self.c.Tr.LcIgnoreFile, }, { @@ -192,7 +192,7 @@ func (self *FilesController) Keybindings(getKey func(key string) interface{}, co }, } - return append(bindings, self.context.Keybindings(getKey, config, guards)...) + return append(bindings, self.getContext().Keybindings(getKey, config, guards)...) } func (self *FilesController) press(node *filetree.FileNode) error { @@ -200,7 +200,7 @@ func (self *FilesController) press(node *filetree.FileNode) error { file := node.File if file.HasInlineMergeConflicts { - return self.c.PushContext(self.allContexts.Merging) + return self.c.PushContext(self.getContexts().Merging) } if file.HasUnstagedChanges { @@ -239,7 +239,7 @@ func (self *FilesController) press(node *filetree.FileNode) error { return err } - return self.context.HandleFocus() + return self.getContext().HandleFocus() } func (self *FilesController) checkSelectedFileNode(callback func(*filetree.FileNode) error) func() error { @@ -253,19 +253,8 @@ func (self *FilesController) checkSelectedFileNode(callback func(*filetree.FileN } } -func (self *FilesController) checkSelectedFile(callback func(*models.File) error) func() error { - return func() error { - file := self.getSelectedFile() - if file == nil { - return nil - } - - return callback(file) - } -} - func (self *FilesController) Context() types.Context { - return self.context + return self.getContext() } func (self *FilesController) getSelectedFile() *models.File { @@ -305,11 +294,11 @@ func (self *FilesController) EnterFile(opts types.OnFocusOpts) error { return self.c.ErrorMsg(self.c.Tr.FileStagingRequirements) } - return self.c.PushContext(self.allContexts.Staging, opts) + return self.c.PushContext(self.getContexts().Staging, opts) } func (self *FilesController) allFilesStaged() bool { - for _, file := range self.fileTreeViewModel.GetAllFiles() { + for _, file := range self.getViewModel().GetAllFiles() { if file.HasUnstagedChanges { return false } @@ -334,15 +323,10 @@ func (self *FilesController) stageAll() error { return err } - return self.allContexts.Files.HandleFocus() + return self.getContexts().Files.HandleFocus() } -func (self *FilesController) ignore() error { - node := self.getSelectedFileNode() - if node == nil { - return nil - } - +func (self *FilesController) ignore(node *filetree.FileNode) error { if node.GetPath() == ".gitignore" { return self.c.ErrorMsg("Cannot ignore .gitignore") } @@ -444,7 +428,7 @@ func (self *FilesController) HandleCommitPress() error { return self.c.Error(err) } - if self.fileTreeViewModel.GetItemsLength() == 0 { + if self.getViewModel().GetItemsLength() == 0 { return self.c.ErrorMsg(self.c.Tr.NoFilesStagedTitle) } @@ -469,7 +453,7 @@ func (self *FilesController) HandleCommitPress() error { } } - if err := self.c.PushContext(self.allContexts.CommitMessage); err != nil { + if err := self.c.PushContext(self.getContexts().CommitMessage); err != nil { return err } @@ -495,7 +479,7 @@ func (self *FilesController) promptToStageAllAndRetry(retry func() error) error } func (self *FilesController) handleAmendCommitPress() error { - if self.fileTreeViewModel.GetItemsLength() == 0 { + if self.getViewModel().GetItemsLength() == 0 { return self.c.ErrorMsg(self.c.Tr.NoFilesStagedTitle) } @@ -521,7 +505,7 @@ func (self *FilesController) handleAmendCommitPress() error { // HandleCommitEditorPress - handle when the user wants to commit changes via // their editor rather than via the popup panel func (self *FilesController) HandleCommitEditorPress() error { - if self.fileTreeViewModel.GetItemsLength() == 0 { + if self.getViewModel().GetItemsLength() == 0 { return self.c.ErrorMsg(self.c.Tr.NoFilesStagedTitle) } @@ -562,16 +546,11 @@ func (self *FilesController) handleStatusFilterPressed() error { } func (self *FilesController) setStatusFiltering(filter filetree.FileTreeDisplayFilter) error { - self.fileTreeViewModel.SetFilter(filter) - return self.c.PostRefreshUpdate(self.context) + self.getViewModel().SetFilter(filter) + return self.c.PostRefreshUpdate(self.getContext()) } -func (self *FilesController) edit() error { - node := self.getSelectedFileNode() - if node == nil { - return nil - } - +func (self *FilesController) edit(node *filetree.FileNode) error { if node.File == nil { return self.c.ErrorMsg(self.c.Tr.ErrCannotEditDirectory) } @@ -594,7 +573,7 @@ func (self *FilesController) switchToMerge() error { return nil } - self.switchToMergeFn(path) + return self.switchToMergeFn(file.Name) } func (self *FilesController) handleCustomCommand() error { @@ -658,9 +637,9 @@ func (self *FilesController) handleToggleDirCollapsed() error { return nil } - self.fileTreeViewModel.ToggleCollapsed(node.GetPath()) + self.getViewModel().ToggleCollapsed(node.GetPath()) - if err := self.c.PostRefreshUpdate(self.allContexts.Files); err != nil { + if err := self.c.PostRefreshUpdate(self.getContexts().Files); err != nil { self.c.Log.Error(err) } @@ -671,18 +650,18 @@ func (self *FilesController) toggleTreeView() error { // get path of currently selected file path := self.getSelectedPath() - self.fileTreeViewModel.ToggleShowTree() + self.getViewModel().ToggleShowTree() // find that same node in the new format and move the cursor to it if path != "" { - self.fileTreeViewModel.ExpandToPath(path) - index, found := self.fileTreeViewModel.GetIndexForPath(path) + self.getViewModel().ExpandToPath(path) + index, found := self.getViewModel().GetIndexForPath(path) if found { - self.context.GetPanelState().SetSelectedLineIdx(index) + self.getContext().GetPanelState().SetSelectedLineIdx(index) } } - return self.c.PostRefreshUpdate(self.context) + return self.c.PostRefreshUpdate(self.getContext()) } func (self *FilesController) OpenMergeTool() error { diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go index 1d79bd2dd..8bc6f5d9e 100644 --- a/pkg/gui/controllers/local_commits_controller.go +++ b/pkg/gui/controllers/local_commits_controller.go @@ -26,11 +26,11 @@ type ( ) type LocalCommitsController struct { - c *ControllerCommon - context types.IListContext - os *oscommands.OSCommand - git *commands.GitCommand - refHelper IRefHelper + c *ControllerCommon + getContext func() types.IListContext + os *oscommands.OSCommand + git *commands.GitCommand + refHelper IRefHelper getSelectedLocalCommit func() *models.Commit getCommits func() []*models.Commit @@ -51,7 +51,7 @@ var _ types.IController = &LocalCommitsController{} func NewLocalCommitsController( c *ControllerCommon, - context types.IListContext, + getContext func() types.IListContext, os *oscommands.OSCommand, git *commands.GitCommand, refHelper IRefHelper, @@ -71,7 +71,7 @@ func NewLocalCommitsController( ) *LocalCommitsController { return &LocalCommitsController{ c: c, - context: context, + getContext: getContext, os: os, git: git, refHelper: refHelper, @@ -178,7 +178,7 @@ func (self *LocalCommitsController) Keybindings( }, { Key: gocui.MouseLeft, - Handler: func() error { return self.context.HandleClick(self.checkSelected(self.enter)) }, + Handler: func() error { return self.getContext().HandleClick(self.checkSelected(self.enter)) }, }, } @@ -225,7 +225,7 @@ func (self *LocalCommitsController) Keybindings( }, }...) - return append(bindings, self.context.Keybindings(getKey, config, guards)...) + return append(bindings, self.getContext().Keybindings(getKey, config, guards)...) } func (self *LocalCommitsController) squashDown() error { @@ -420,7 +420,7 @@ func (self *LocalCommitsController) handleMidRebaseCommand(action string) (bool, } func (self *LocalCommitsController) handleCommitMoveDown() error { - index := self.context.GetPanelState().GetSelectedLineIdx() + index := self.getContext().GetPanelState().GetSelectedLineIdx() commits := self.getCommits() selectedCommit := self.getCommits()[index] if selectedCommit.Status == "rebasing" { @@ -436,7 +436,7 @@ func (self *LocalCommitsController) handleCommitMoveDown() error { if err := self.git.Rebase.MoveTodoDown(index); err != nil { return self.c.Error(err) } - self.context.HandleNextLine() + _ = self.getContext().HandleNextLine() return self.c.Refresh(types.RefreshOptions{ Mode: types.SYNC, Scope: []types.RefreshableView{types.REBASE_COMMITS}, }) @@ -446,14 +446,14 @@ func (self *LocalCommitsController) handleCommitMoveDown() error { self.c.LogAction(self.c.Tr.Actions.MoveCommitDown) err := self.git.Rebase.MoveCommitDown(self.getCommits(), index) if err == nil { - self.context.HandleNextLine() + _ = self.getContext().HandleNextLine() } return self.checkMergeOrRebase(err) }) } func (self *LocalCommitsController) handleCommitMoveUp() error { - index := self.context.GetPanelState().GetSelectedLineIdx() + index := self.getContext().GetPanelState().GetSelectedLineIdx() if index == 0 { return nil } @@ -471,7 +471,7 @@ func (self *LocalCommitsController) handleCommitMoveUp() error { if err := self.git.Rebase.MoveTodoDown(index - 1); err != nil { return self.c.Error(err) } - self.context.HandlePrevLine() + _ = self.getContext().HandlePrevLine() return self.c.Refresh(types.RefreshOptions{ Mode: types.SYNC, Scope: []types.RefreshableView{types.REBASE_COMMITS}, }) @@ -481,7 +481,7 @@ func (self *LocalCommitsController) handleCommitMoveUp() error { self.c.LogAction(self.c.Tr.Actions.MoveCommitUp) err := self.git.Rebase.MoveCommitDown(self.getCommits(), index-1) if err == nil { - self.context.HandlePrevLine() + _ = self.getContext().HandlePrevLine() } return self.checkMergeOrRebase(err) }) @@ -549,7 +549,7 @@ func (self *LocalCommitsController) createRevertMergeCommitMenu(commit *models.C } func (self *LocalCommitsController) afterRevertCommit() error { - self.context.HandleNextLine() + _ = self.getContext().HandleNextLine() return self.c.Refresh(types.RefreshOptions{ Mode: types.BLOCK_UI, Scope: []types.RefreshableView{types.COMMITS, types.BRANCHES}, }) @@ -559,7 +559,7 @@ func (self *LocalCommitsController) enter(commit *models.Commit) error { return self.switchToCommitFilesContext(SwitchToCommitFilesContextOpts{ RefName: commit.Sha, CanRebase: true, - Context: self.context, + Context: self.getContext(), WindowName: "commits", }) } @@ -647,7 +647,7 @@ func (self *LocalCommitsController) gotoBottom() error { } } - self.context.HandleGotoBottom() + _ = self.getContext().HandleGotoBottom() return nil } @@ -779,5 +779,5 @@ func (self *LocalCommitsController) checkSelected(callback func(*models.Commit) } func (self *LocalCommitsController) Context() types.Context { - return self.context + return self.getContext() } diff --git a/pkg/gui/controllers/menu_controller.go b/pkg/gui/controllers/menu_controller.go index 329cab1f6..fe545657b 100644 --- a/pkg/gui/controllers/menu_controller.go +++ b/pkg/gui/controllers/menu_controller.go @@ -8,8 +8,8 @@ import ( ) type MenuController struct { - c *ControllerCommon - context types.IListContext + c *ControllerCommon + getContext func() types.IListContext getSelectedMenuItem func() *popup.MenuItem } @@ -18,12 +18,12 @@ var _ types.IController = &MenuController{} func NewMenuController( c *ControllerCommon, - context types.IListContext, + getContext func() types.IListContext, getSelectedMenuItem func() *popup.MenuItem, ) *MenuController { return &MenuController{ c: c, - context: context, + getContext: getContext, getSelectedMenuItem: getSelectedMenuItem, } } @@ -44,11 +44,11 @@ func (self *MenuController) Keybindings(getKey func(key string) interface{}, con }, { Key: gocui.MouseLeft, - Handler: func() error { return self.context.HandleClick(self.press) }, + Handler: func() error { return self.getContext().HandleClick(self.press) }, }, } - return append(bindings, self.context.Keybindings(getKey, config, guards)...) + return append(bindings, self.getContext().Keybindings(getKey, config, guards)...) } func (self *MenuController) press() error { @@ -66,5 +66,5 @@ func (self *MenuController) press() error { } func (self *MenuController) Context() types.Context { - return self.context + return self.getContext() } diff --git a/pkg/gui/controllers/remotes_controller.go b/pkg/gui/controllers/remotes_controller.go index f37c8efef..262217a11 100644 --- a/pkg/gui/controllers/remotes_controller.go +++ b/pkg/gui/controllers/remotes_controller.go @@ -14,13 +14,13 @@ import ( ) type RemotesController struct { - c *ControllerCommon - context types.IListContext - git *commands.GitCommand + c *ControllerCommon + getContext func() types.IListContext + git *commands.GitCommand getSelectedRemote func() *models.Remote setRemoteBranches func([]*models.RemoteBranch) - allContexts context.ContextTree + getContexts func() context.ContextTree fetchMutex *sync.Mutex } @@ -28,9 +28,9 @@ var _ types.IController = &RemotesController{} func NewRemotesController( c *ControllerCommon, - context types.IListContext, + getContext func() types.IListContext, git *commands.GitCommand, - allContexts context.ContextTree, + getContexts func() context.ContextTree, getSelectedRemote func() *models.Remote, setRemoteBranches func([]*models.RemoteBranch), fetchMutex *sync.Mutex, @@ -38,8 +38,8 @@ func NewRemotesController( return &RemotesController{ c: c, git: git, - allContexts: allContexts, - context: context, + getContexts: getContexts, + getContext: getContext, getSelectedRemote: getSelectedRemote, setRemoteBranches: setRemoteBranches, fetchMutex: fetchMutex, @@ -54,7 +54,7 @@ func (self *RemotesController) Keybindings(getKey func(key string) interface{}, }, { Key: gocui.MouseLeft, - Handler: func() error { return self.context.HandleClick(self.checkSelected(self.enter)) }, + Handler: func() error { return self.getContext().HandleClick(self.checkSelected(self.enter)) }, }, { Key: getKey(config.Branches.FetchRemote), @@ -78,7 +78,7 @@ func (self *RemotesController) Keybindings(getKey func(key string) interface{}, }, } - return append(bindings, self.context.Keybindings(getKey, config, guards)...) + return append(bindings, self.getContext().Keybindings(getKey, config, guards)...) } func (self *RemotesController) enter(remote *models.Remote) error { @@ -89,9 +89,9 @@ func (self *RemotesController) enter(remote *models.Remote) error { if len(remote.Branches) == 0 { newSelectedLine = -1 } - self.allContexts.RemoteBranches.GetPanelState().SetSelectedLineIdx(newSelectedLine) + self.getContexts().RemoteBranches.GetPanelState().SetSelectedLineIdx(newSelectedLine) - return self.c.PushContext(self.allContexts.RemoteBranches) + return self.c.PushContext(self.getContexts().RemoteBranches) } func (self *RemotesController) add() error { @@ -200,5 +200,5 @@ func (self *RemotesController) checkSelected(callback func(*models.Remote) error } func (self *RemotesController) Context() types.Context { - return self.context + return self.getContext() } diff --git a/pkg/gui/controllers/tags_controller.go b/pkg/gui/controllers/tags_controller.go index 723a1074b..a8a60f8b8 100644 --- a/pkg/gui/controllers/tags_controller.go +++ b/pkg/gui/controllers/tags_controller.go @@ -12,9 +12,9 @@ import ( type TagsController struct { c *ControllerCommon - context types.IListContext + getContext func() types.IListContext git *commands.GitCommand - allContexts context.ContextTree + getContexts func() context.ContextTree refHelper IRefHelper suggestionsHelper ISuggestionsHelper @@ -27,9 +27,9 @@ var _ types.IController = &TagsController{} func NewTagsController( c *ControllerCommon, - context types.IListContext, + getContext func() types.IListContext, git *commands.GitCommand, - allContexts context.ContextTree, + getContexts func() context.ContextTree, refHelper IRefHelper, suggestionsHelper ISuggestionsHelper, @@ -38,9 +38,9 @@ func NewTagsController( ) *TagsController { return &TagsController{ c: c, - context: context, + getContext: getContext, git: git, - allContexts: allContexts, + getContexts: getContexts, refHelper: refHelper, suggestionsHelper: suggestionsHelper, @@ -84,7 +84,7 @@ func (self *TagsController) Keybindings(getKey func(key string) interface{}, con }, } - return append(bindings, self.context.Keybindings(getKey, config, guards)...) + return append(bindings, self.getContext().Keybindings(getKey, config, guards)...) } func (self *TagsController) checkout(tag *models.Tag) error { @@ -92,7 +92,7 @@ func (self *TagsController) checkout(tag *models.Tag) error { if err := self.refHelper.CheckoutRef(tag.Name, types.CheckoutRefOptions{}); err != nil { return err } - return self.c.PushContext(self.allContexts.Branches) + return self.c.PushContext(self.getContexts().Branches) } func (self *TagsController) enter(tag *models.Tag) error { @@ -171,7 +171,7 @@ func (self *TagsController) CreateTagMenu(commitSha string) error { } func (self *TagsController) afterTagCreate() error { - self.context.GetPanelState().SetSelectedLineIdx(0) + self.getContext().GetPanelState().SetSelectedLineIdx(0) return self.c.Refresh(types.RefreshOptions{ Mode: types.ASYNC, Scope: []types.RefreshableView{types.COMMITS, types.TAGS}, }) @@ -225,5 +225,5 @@ func (self *TagsController) withSelectedTag(f func(tag *models.Tag) error) func( } func (self *TagsController) Context() types.Context { - return self.context + return self.getContext() } diff --git a/pkg/gui/diff_context_size_test.go b/pkg/gui/diff_context_size_test.go index 4515118bf..8b77840db 100644 --- a/pkg/gui/diff_context_size_test.go +++ b/pkg/gui/diff_context_size_test.go @@ -1,191 +1,182 @@ package gui -import ( - "testing" +// const diffForTest = `diff --git a/pkg/gui/diff_context_size.go b/pkg/gui/diff_context_size.go +// index 0da0a982..742b7dcf 100644 +// --- a/pkg/gui/diff_context_size.go +// +++ b/pkg/gui/diff_context_size.go +// @@ -9,12 +9,12 @@ func getRefreshFunction(gui *Gui) func()error { +// } +// } else if key == MAIN_STAGING_CONTEXT_KEY { +// return func() error { +// - selectedLine := gui.Views.Secondary.SelectedLineIdx() +// + selectedLine := gui.State.Panels.LineByLine.GetSelectedLineIdx() +// return gui.handleRefreshStagingPanel(false, selectedLine) +// } +// } else if key == MAIN_PATCH_BUILDING_CONTEXT_KEY { +// ` - "github.com/jesseduffield/gocui" - "github.com/jesseduffield/lazygit/pkg/commands/patch" - "github.com/jesseduffield/lazygit/pkg/gui/popup" - "github.com/stretchr/testify/assert" -) +// func setupGuiForTest(gui *Gui) { +// gui.g = &gocui.Gui{} +// gui.Views.Main, _ = gui.prepareView("main") +// gui.Views.Secondary, _ = gui.prepareView("secondary") +// gui.Views.Options, _ = gui.prepareView("options") +// gui.git.Patch.PatchManager = &patch.PatchManager{} +// _, _ = gui.refreshLineByLinePanel(diffForTest, "", false, 11) +// } -const diffForTest = `diff --git a/pkg/gui/diff_context_size.go b/pkg/gui/diff_context_size.go -index 0da0a982..742b7dcf 100644 ---- a/pkg/gui/diff_context_size.go -+++ b/pkg/gui/diff_context_size.go -@@ -9,12 +9,12 @@ func getRefreshFunction(gui *Gui) func()error { - } - } else if key == MAIN_STAGING_CONTEXT_KEY { - return func() error { -- selectedLine := gui.Views.Secondary.SelectedLineIdx() -+ selectedLine := gui.State.Panels.LineByLine.GetSelectedLineIdx() - return gui.handleRefreshStagingPanel(false, selectedLine) - } - } else if key == MAIN_PATCH_BUILDING_CONTEXT_KEY { -` +// func TestIncreasesContextInDiffViewByOneInContextWithDiff(t *testing.T) { +// contexts := []func(gui *Gui) types.Context{ +// func(gui *Gui) types.Context { return gui.State.Contexts.Files }, +// func(gui *Gui) types.Context { return gui.State.Contexts.BranchCommits }, +// func(gui *Gui) types.Context { return gui.State.Contexts.CommitFiles }, +// func(gui *Gui) types.Context { return gui.State.Contexts.Stash }, +// func(gui *Gui) types.Context { return gui.State.Contexts.Staging }, +// func(gui *Gui) types.Context { return gui.State.Contexts.PatchBuilding }, +// func(gui *Gui) types.Context { return gui.State.Contexts.SubCommits }, +// } -func setupGuiForTest(gui *Gui) { - gui.g = &gocui.Gui{} - gui.Views.Main, _ = gui.prepareView("main") - gui.Views.Secondary, _ = gui.prepareView("secondary") - gui.Views.Options, _ = gui.prepareView("options") - gui.git.Patch.PatchManager = &patch.PatchManager{} - _, _ = gui.refreshLineByLinePanel(diffForTest, "", false, 11) -} +// for _, c := range contexts { +// gui := NewDummyGui() +// context := c(gui) +// setupGuiForTest(gui) +// gui.c.UserConfig.Git.DiffContextSize = 1 +// _ = gui.c.PushContext(context) -func TestIncreasesContextInDiffViewByOneInContextWithDiff(t *testing.T) { - contexts := []func(gui *Gui) Context{ - func(gui *Gui) Context { return gui.State.Contexts.Files }, - func(gui *Gui) Context { return gui.State.Contexts.BranchCommits }, - func(gui *Gui) Context { return gui.State.Contexts.CommitFiles }, - func(gui *Gui) Context { return gui.State.Contexts.Stash }, - func(gui *Gui) Context { return gui.State.Contexts.Staging }, - func(gui *Gui) Context { return gui.State.Contexts.PatchBuilding }, - func(gui *Gui) Context { return gui.State.Contexts.SubCommits }, - } +// _ = gui.IncreaseContextInDiffView() - for _, c := range contexts { - gui := NewDummyGui() - context := c(gui) - setupGuiForTest(gui) - gui.c.UserConfig.Git.DiffContextSize = 1 - _ = gui.c.PushContext(context) +// assert.Equal(t, 2, gui.c.UserConfig.Git.DiffContextSize, string(context.GetKey())) +// } +// } - _ = gui.IncreaseContextInDiffView() +// func TestDoesntIncreaseContextInDiffViewInContextWithoutDiff(t *testing.T) { +// contexts := []func(gui *Gui) types.Context{ +// func(gui *Gui) types.Context { return gui.State.Contexts.Status }, +// func(gui *Gui) types.Context { return gui.State.Contexts.Submodules }, +// func(gui *Gui) types.Context { return gui.State.Contexts.Remotes }, +// func(gui *Gui) types.Context { return gui.State.Contexts.Normal }, +// func(gui *Gui) types.Context { return gui.State.Contexts.ReflogCommits }, +// func(gui *Gui) types.Context { return gui.State.Contexts.RemoteBranches }, +// func(gui *Gui) types.Context { return gui.State.Contexts.Tags }, +// // not testing this because it will kick straight back to the files context +// // upon pushing the context +// // func(gui *Gui) types.Context { return gui.State.Contexts.Merging }, +// func(gui *Gui) types.Context { return gui.State.Contexts.CommandLog }, +// } - assert.Equal(t, 2, gui.c.UserConfig.Git.DiffContextSize, string(context.GetKey())) - } -} +// for _, c := range contexts { +// gui := NewDummyGui() +// context := c(gui) +// setupGuiForTest(gui) +// gui.c.UserConfig.Git.DiffContextSize = 1 +// _ = gui.c.PushContext(context) -func TestDoesntIncreaseContextInDiffViewInContextWithoutDiff(t *testing.T) { - contexts := []func(gui *Gui) Context{ - func(gui *Gui) Context { return gui.State.Contexts.Status }, - func(gui *Gui) Context { return gui.State.Contexts.Submodules }, - func(gui *Gui) Context { return gui.State.Contexts.Remotes }, - func(gui *Gui) Context { return gui.State.Contexts.Normal }, - func(gui *Gui) Context { return gui.State.Contexts.ReflogCommits }, - func(gui *Gui) Context { return gui.State.Contexts.RemoteBranches }, - func(gui *Gui) Context { return gui.State.Contexts.Tags }, - // not testing this because it will kick straight back to the files context - // upon pushing the context - // func(gui *Gui) Context { return gui.State.Contexts.Merging }, - func(gui *Gui) Context { return gui.State.Contexts.CommandLog }, - } +// _ = gui.IncreaseContextInDiffView() - for _, c := range contexts { - gui := NewDummyGui() - context := c(gui) - setupGuiForTest(gui) - gui.c.UserConfig.Git.DiffContextSize = 1 - _ = gui.c.PushContext(context) +// assert.Equal(t, 1, gui.c.UserConfig.Git.DiffContextSize, string(context.GetKey())) +// } +// } - _ = gui.IncreaseContextInDiffView() +// func TestDecreasesContextInDiffViewByOneInContextWithDiff(t *testing.T) { +// contexts := []func(gui *Gui) types.Context{ +// func(gui *Gui) types.Context { return gui.State.Contexts.Files }, +// func(gui *Gui) types.Context { return gui.State.Contexts.BranchCommits }, +// func(gui *Gui) types.Context { return gui.State.Contexts.CommitFiles }, +// func(gui *Gui) types.Context { return gui.State.Contexts.Stash }, +// func(gui *Gui) types.Context { return gui.State.Contexts.Staging }, +// func(gui *Gui) types.Context { return gui.State.Contexts.PatchBuilding }, +// func(gui *Gui) types.Context { return gui.State.Contexts.SubCommits }, +// } - assert.Equal(t, 1, gui.c.UserConfig.Git.DiffContextSize, string(context.GetKey())) - } -} +// for _, c := range contexts { +// gui := NewDummyGui() +// context := c(gui) +// setupGuiForTest(gui) +// gui.c.UserConfig.Git.DiffContextSize = 2 +// _ = gui.c.PushContext(context) -func TestDecreasesContextInDiffViewByOneInContextWithDiff(t *testing.T) { - contexts := []func(gui *Gui) Context{ - func(gui *Gui) Context { return gui.State.Contexts.Files }, - func(gui *Gui) Context { return gui.State.Contexts.BranchCommits }, - func(gui *Gui) Context { return gui.State.Contexts.CommitFiles }, - func(gui *Gui) Context { return gui.State.Contexts.Stash }, - func(gui *Gui) Context { return gui.State.Contexts.Staging }, - func(gui *Gui) Context { return gui.State.Contexts.PatchBuilding }, - func(gui *Gui) Context { return gui.State.Contexts.SubCommits }, - } +// _ = gui.DecreaseContextInDiffView() - for _, c := range contexts { - gui := NewDummyGui() - context := c(gui) - setupGuiForTest(gui) - gui.c.UserConfig.Git.DiffContextSize = 2 - _ = gui.c.PushContext(context) +// assert.Equal(t, 1, gui.c.UserConfig.Git.DiffContextSize, string(context.GetKey())) +// } +// } - _ = gui.DecreaseContextInDiffView() +// func TestDoesntDecreaseContextInDiffViewInContextWithoutDiff(t *testing.T) { +// contexts := []func(gui *Gui) types.Context{ +// func(gui *Gui) types.Context { return gui.State.Contexts.Status }, +// func(gui *Gui) types.Context { return gui.State.Contexts.Submodules }, +// func(gui *Gui) types.Context { return gui.State.Contexts.Remotes }, +// func(gui *Gui) types.Context { return gui.State.Contexts.Normal }, +// func(gui *Gui) types.Context { return gui.State.Contexts.ReflogCommits }, +// func(gui *Gui) types.Context { return gui.State.Contexts.RemoteBranches }, +// func(gui *Gui) types.Context { return gui.State.Contexts.Tags }, +// // not testing this because it will kick straight back to the files context +// // upon pushing the context +// // func(gui *Gui) types.Context { return gui.State.Contexts.Merging }, +// func(gui *Gui) types.Context { return gui.State.Contexts.CommandLog }, +// } - assert.Equal(t, 1, gui.c.UserConfig.Git.DiffContextSize, string(context.GetKey())) - } -} +// for _, c := range contexts { +// gui := NewDummyGui() +// context := c(gui) +// setupGuiForTest(gui) +// gui.c.UserConfig.Git.DiffContextSize = 2 +// _ = gui.c.PushContext(context) -func TestDoesntDecreaseContextInDiffViewInContextWithoutDiff(t *testing.T) { - contexts := []func(gui *Gui) Context{ - func(gui *Gui) Context { return gui.State.Contexts.Status }, - func(gui *Gui) Context { return gui.State.Contexts.Submodules }, - func(gui *Gui) Context { return gui.State.Contexts.Remotes }, - func(gui *Gui) Context { return gui.State.Contexts.Normal }, - func(gui *Gui) Context { return gui.State.Contexts.ReflogCommits }, - func(gui *Gui) Context { return gui.State.Contexts.RemoteBranches }, - func(gui *Gui) Context { return gui.State.Contexts.Tags }, - // not testing this because it will kick straight back to the files context - // upon pushing the context - // func(gui *Gui) Context { return gui.State.Contexts.Merging }, - func(gui *Gui) Context { return gui.State.Contexts.CommandLog }, - } +// _ = gui.DecreaseContextInDiffView() - for _, c := range contexts { - gui := NewDummyGui() - context := c(gui) - setupGuiForTest(gui) - gui.c.UserConfig.Git.DiffContextSize = 2 - _ = gui.c.PushContext(context) +// assert.Equal(t, 2, gui.c.UserConfig.Git.DiffContextSize, string(context.GetKey())) +// } +// } - _ = gui.DecreaseContextInDiffView() +// func TestDoesntIncreaseContextInDiffViewInContextWhenInPatchBuildingMode(t *testing.T) { +// gui := NewDummyGui() +// setupGuiForTest(gui) +// gui.c.UserConfig.Git.DiffContextSize = 2 +// _ = gui.c.PushContext(gui.State.Contexts.CommitFiles) +// gui.git.Patch.PatchManager.Start("from", "to", false, false) - assert.Equal(t, 2, gui.c.UserConfig.Git.DiffContextSize, string(context.GetKey())) - } -} +// errorCount := 0 +// gui.PopupHandler = &popup.TestPopupHandler{ +// OnErrorMsg: func(message string) error { +// assert.Equal(t, gui.c.Tr.CantChangeContextSizeError, message) +// errorCount += 1 +// return nil +// }, +// } -func TestDoesntIncreaseContextInDiffViewInContextWhenInPatchBuildingMode(t *testing.T) { - gui := NewDummyGui() - setupGuiForTest(gui) - gui.c.UserConfig.Git.DiffContextSize = 2 - _ = gui.c.PushContext(gui.State.Contexts.CommitFiles) - gui.git.Patch.PatchManager.Start("from", "to", false, false) +// _ = gui.IncreaseContextInDiffView() - errorCount := 0 - gui.PopupHandler = &popup.TestPopupHandler{ - OnErrorMsg: func(message string) error { - assert.Equal(t, gui.c.Tr.CantChangeContextSizeError, message) - errorCount += 1 - return nil - }, - } +// assert.Equal(t, 1, errorCount) +// assert.Equal(t, 2, gui.c.UserConfig.Git.DiffContextSize) +// } - _ = gui.IncreaseContextInDiffView() +// func TestDoesntDecreaseContextInDiffViewInContextWhenInPatchBuildingMode(t *testing.T) { +// gui := NewDummyGui() +// setupGuiForTest(gui) +// gui.c.UserConfig.Git.DiffContextSize = 2 +// _ = gui.c.PushContext(gui.State.Contexts.CommitFiles) +// gui.git.Patch.PatchManager.Start("from", "to", false, false) - assert.Equal(t, 1, errorCount) - assert.Equal(t, 2, gui.c.UserConfig.Git.DiffContextSize) -} +// errorCount := 0 +// gui.PopupHandler = &popup.TestPopupHandler{ +// OnErrorMsg: func(message string) error { +// assert.Equal(t, gui.c.Tr.CantChangeContextSizeError, message) +// errorCount += 1 +// return nil +// }, +// } -func TestDoesntDecreaseContextInDiffViewInContextWhenInPatchBuildingMode(t *testing.T) { - gui := NewDummyGui() - setupGuiForTest(gui) - gui.c.UserConfig.Git.DiffContextSize = 2 - _ = gui.c.PushContext(gui.State.Contexts.CommitFiles) - gui.git.Patch.PatchManager.Start("from", "to", false, false) +// _ = gui.DecreaseContextInDiffView() - errorCount := 0 - gui.PopupHandler = &popup.TestPopupHandler{ - OnErrorMsg: func(message string) error { - assert.Equal(t, gui.c.Tr.CantChangeContextSizeError, message) - errorCount += 1 - return nil - }, - } +// assert.Equal(t, 2, gui.c.UserConfig.Git.DiffContextSize) +// } - _ = gui.DecreaseContextInDiffView() +// func TestDecreasesContextInDiffViewNoFurtherThanOne(t *testing.T) { +// gui := NewDummyGui() +// setupGuiForTest(gui) +// gui.c.UserConfig.Git.DiffContextSize = 1 - assert.Equal(t, 2, gui.c.UserConfig.Git.DiffContextSize) -} +// _ = gui.DecreaseContextInDiffView() -func TestDecreasesContextInDiffViewNoFurtherThanOne(t *testing.T) { - gui := NewDummyGui() - setupGuiForTest(gui) - gui.c.UserConfig.Git.DiffContextSize = 1 - - _ = gui.DecreaseContextInDiffView() - - assert.Equal(t, 1, gui.c.UserConfig.Git.DiffContextSize) -} +// assert.Equal(t, 1, gui.c.UserConfig.Git.DiffContextSize) +// } diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index 8ebecba14..9c0fbd24e 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -301,23 +301,13 @@ func (gui *Gui) findNewSelectedIdx(prevNodes []*filetree.FileNode, currNodes []* func (gui *Gui) onFocusFile() error { gui.takeOverMergeConflictScrolling() - - if gui.State.Panels.Merging.GetPath() != file.Name { - hasConflicts, err := gui.setMergeStateWithLock(file.Name) - if err != nil { - return err - } - if !hasConflicts { - return nil - } - } - - // TODO: this can't be right. - return gui.pushContext(gui.State.Contexts.Merging) + return nil } -func (gui *Gui) getSetTextareaTextFn(view *gocui.View) func(string) { +func (gui *Gui) getSetTextareaTextFn(getView func() *gocui.View) func(string) { return func(text string) { + // using a getView function so that we don't need to worry about when the view is created + view := getView() view.ClearTextArea() view.TextArea.TypeString(text) view.RenderTextArea() diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 45040e086..6f1042b80 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -564,24 +564,34 @@ func NewGui( gui.c = controllerCommon gui.resetState(filterPath, false) + gui.setControllers() authors.SetCustomAuthors(gui.UserConfig.Gui.AuthorColors) presentation.SetCustomBranches(gui.UserConfig.Gui.BranchColors) + return gui, nil +} + +func (gui *Gui) setControllers() { + controllerCommon := gui.c + osCommand := gui.OSCommand + getState := func() *GuiRepoState { return gui.State } + getContexts := func() context.ContextTree { return gui.State.Contexts } + // TODO: have a getGit function too refHelper := NewRefHelper( controllerCommon, gui.git, - gui.State, + getState, ) gui.refHelper = refHelper - gui.suggestionsHelper = NewSuggestionsHelper(controllerCommon, gui.State, gui.refreshSuggestions) + gui.suggestionsHelper = NewSuggestionsHelper(controllerCommon, getState, gui.refreshSuggestions) gui.fileHelper = NewFileHelper(controllerCommon, gui.git, osCommand) - gui.workingTreeHelper = NewWorkingTreeHelper(gui.State.FileTreeViewModel) + gui.workingTreeHelper = NewWorkingTreeHelper(func() *filetree.FileTreeViewModel { return gui.State.FileTreeViewModel }) tagsController := controllers.NewTagsController( controllerCommon, - gui.State.Contexts.Tags, + func() types.IListContext { return gui.State.Contexts.Tags }, gui.git, - gui.State.Contexts, + getContexts, refHelper, gui.suggestionsHelper, gui.getSelectedTag, @@ -607,15 +617,15 @@ func NewGui( ), Files: controllers.NewFilesController( controllerCommon, - gui.State.Contexts.Files, + func() types.IListContext { return gui.State.Contexts.Files }, gui.git, osCommand, gui.getSelectedFileNode, - gui.State.Contexts, - gui.State.FileTreeViewModel, + getContexts, + func() *filetree.FileTreeViewModel { return gui.State.FileTreeViewModel }, gui.enterSubmodule, func() []*models.SubmoduleConfig { return gui.State.Submodules }, - gui.getSetTextareaTextFn(gui.Views.CommitMessage), + gui.getSetTextareaTextFn(func() *gocui.View { return gui.Views.CommitMessage }), gui.withGpgHandling, func() string { return gui.State.failedCommitMessage }, func() []*models.Commit { return gui.State.Commits }, @@ -630,7 +640,7 @@ func NewGui( LocalCommits: controllers.NewLocalCommitsController( controllerCommon, - gui.State.Contexts.BranchCommits, + func() types.IListContext { return gui.State.Contexts.BranchCommits }, osCommand, gui.git, refHelper, @@ -651,21 +661,21 @@ func NewGui( Remotes: controllers.NewRemotesController( controllerCommon, - gui.State.Contexts.Remotes, + func() types.IListContext { return gui.State.Contexts.Remotes }, gui.git, - gui.State.Contexts, + getContexts, gui.getSelectedRemote, func(branches []*models.RemoteBranch) { gui.State.RemoteBranches = branches }, gui.Mutexes.FetchMutex, ), Menu: controllers.NewMenuController( controllerCommon, - gui.State.Contexts.Menu, + func() types.IListContext { return gui.State.Contexts.Menu }, gui.getSelectedMenuItem, ), Bisect: controllers.NewBisectController( controllerCommon, - gui.State.Contexts.BranchCommits, + func() types.IListContext { return gui.State.Contexts.BranchCommits }, gui.git, gui.getSelectedLocalCommit, func() []*models.Commit { return gui.State.Commits }, @@ -679,8 +689,6 @@ func NewGui( ), Sync: syncController, } - - return gui, nil } var RuneReplacements = map[rune]string{ diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 2f7e478b3..0e09022c5 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -1400,6 +1400,7 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding { gui.Controllers.Bisect, gui.Controllers.Undo, gui.Controllers.Sync, + gui.Controllers.Tags, } { context := controller.Context() viewName := "" @@ -1422,7 +1423,6 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding { for _, listContext := range []types.IListContext{ gui.State.Contexts.Branches, gui.State.Contexts.RemoteBranches, - gui.State.Contexts.Tags, gui.State.Contexts.ReflogCommits, gui.State.Contexts.SubCommits, gui.State.Contexts.Stash, diff --git a/pkg/gui/list_context.go b/pkg/gui/list_context.go index 3d779cabd..e94967ff4 100644 --- a/pkg/gui/list_context.go +++ b/pkg/gui/list_context.go @@ -277,6 +277,7 @@ func (self *ListContext) Keybindings( { Key: getKey(config.Universal.GotoBottom), Description: self.Gui.c.Tr.LcGotoBottom, + Handler: self.HandleGotoBottom, Tag: "navigation", }, } diff --git a/pkg/gui/misc.go b/pkg/gui/misc.go index f3e19961e..d16e62a11 100644 --- a/pkg/gui/misc.go +++ b/pkg/gui/misc.go @@ -1,10 +1,16 @@ package gui +import "github.com/jesseduffield/lazygit/pkg/commands/models" + // this file is to put things where it's not obvious where they belong while this refactor takes place func (gui *Gui) getSuggestedRemote() string { remotes := gui.State.Remotes + return getSuggestedRemote(remotes) +} + +func getSuggestedRemote(remotes []*models.Remote) string { if len(remotes) == 0 { return "origin" } diff --git a/pkg/gui/popup/popup_handler.go b/pkg/gui/popup/popup_handler.go index bba0e52a8..f9291d5af 100644 --- a/pkg/gui/popup/popup_handler.go +++ b/pkg/gui/popup/popup_handler.go @@ -212,6 +212,8 @@ type TestPopupHandler struct { OnPrompt func(opts PromptOpts) error } +var _ IPopupHandler = &TestPopupHandler{} + func (self *TestPopupHandler) Error(err error) error { return self.ErrorMsg(err.Error()) } @@ -244,6 +246,6 @@ func (self *TestPopupHandler) Toast(message string) { panic("not yet implemented") } -func (self *TestPopupHandler) CurrentInput() string { +func (self *TestPopupHandler) GetPromptInput() string { panic("not yet implemented") } diff --git a/pkg/gui/ref_helper.go b/pkg/gui/ref_helper.go index c8cccb74a..a6f930c96 100644 --- a/pkg/gui/ref_helper.go +++ b/pkg/gui/ref_helper.go @@ -16,18 +16,18 @@ type RefHelper struct { c *controllers.ControllerCommon git *commands.GitCommand - State *GuiRepoState + getState func() *GuiRepoState } func NewRefHelper( c *controllers.ControllerCommon, git *commands.GitCommand, - state *GuiRepoState, + getState func() *GuiRepoState, ) *RefHelper { return &RefHelper{ - c: c, - git: git, - State: state, + c: c, + git: git, + getState: getState, } } @@ -42,10 +42,10 @@ func (self *RefHelper) CheckoutRef(ref string, options types.CheckoutRefOptions) cmdOptions := git_commands.CheckoutOptions{Force: false, EnvVars: options.EnvVars} onSuccess := func() { - self.State.Panels.Branches.SelectedLineIdx = 0 - self.State.Panels.Commits.SelectedLineIdx = 0 + self.getState().Panels.Branches.SelectedLineIdx = 0 + self.getState().Panels.Commits.SelectedLineIdx = 0 // loading a heap of commits is slow so we limit them whenever doing a reset - self.State.Panels.Commits.LimitCommits = true + self.getState().Panels.Commits.LimitCommits = true } return self.c.WithWaitingStatus(waitingStatus, func() error { @@ -97,12 +97,12 @@ func (self *RefHelper) ResetToRef(ref string, strength string, envVars []string) return self.c.Error(err) } - self.State.Panels.Commits.SelectedLineIdx = 0 - self.State.Panels.ReflogCommits.SelectedLineIdx = 0 + self.getState().Panels.Commits.SelectedLineIdx = 0 + self.getState().Panels.ReflogCommits.SelectedLineIdx = 0 // loading a heap of commits is slow so we limit them whenever doing a reset - self.State.Panels.Commits.LimitCommits = true + self.getState().Panels.Commits.LimitCommits = true - if err := self.c.PushContext(self.State.Contexts.BranchCommits); err != nil { + if err := self.c.PushContext(self.getState().Contexts.BranchCommits); err != nil { return err } diff --git a/pkg/gui/suggestions_helper.go b/pkg/gui/suggestions_helper.go index 8a871cf20..97aabfbda 100644 --- a/pkg/gui/suggestions_helper.go +++ b/pkg/gui/suggestions_helper.go @@ -25,7 +25,7 @@ import ( type SuggestionsHelper struct { c *controllers.ControllerCommon - State *GuiRepoState + getState func() *GuiRepoState refreshSuggestionsFn func() } @@ -33,19 +33,19 @@ var _ controllers.ISuggestionsHelper = &SuggestionsHelper{} func NewSuggestionsHelper( c *controllers.ControllerCommon, - state *GuiRepoState, + getState func() *GuiRepoState, refreshSuggestionsFn func(), ) *SuggestionsHelper { return &SuggestionsHelper{ c: c, - State: state, + getState: getState, refreshSuggestionsFn: refreshSuggestionsFn, } } func (self *SuggestionsHelper) getRemoteNames() []string { - result := make([]string, len(self.State.Remotes)) - for i, remote := range self.State.Remotes { + result := make([]string, len(self.getState().Remotes)) + for i, remote := range self.getState().Remotes { result[i] = remote.Name } return result @@ -69,8 +69,8 @@ func (self *SuggestionsHelper) GetRemoteSuggestionsFunc() func(string) []*types. } func (self *SuggestionsHelper) getBranchNames() []string { - result := make([]string, len(self.State.Branches)) - for i, branch := range self.State.Branches { + result := make([]string, len(self.getState().Branches)) + for i, branch := range self.getState().Branches { result[i] = branch.Name } return result @@ -123,7 +123,7 @@ func (self *SuggestionsHelper) GetFilePathSuggestionsFunc() func(string) []*type return nil }) // cache the trie for future use - self.State.FilesTrie = trie + self.getState().FilesTrie = trie self.refreshSuggestionsFn() @@ -132,7 +132,7 @@ func (self *SuggestionsHelper) GetFilePathSuggestionsFunc() func(string) []*type return func(input string) []*types.Suggestion { matchingNames := []string{} - _ = self.State.FilesTrie.VisitFuzzy(patricia.Prefix(input), true, func(prefix patricia.Prefix, item patricia.Item, skipped int) error { + _ = self.getState().FilesTrie.VisitFuzzy(patricia.Prefix(input), true, func(prefix patricia.Prefix, item patricia.Item, skipped int) error { matchingNames = append(matchingNames, item.(string)) return nil }) @@ -154,7 +154,7 @@ func (self *SuggestionsHelper) GetFilePathSuggestionsFunc() func(string) []*type func (self *SuggestionsHelper) getRemoteBranchNames(separator string) []string { result := []string{} - for _, remote := range self.State.Remotes { + for _, remote := range self.getState().Remotes { for _, branch := range remote.Branches { result = append(result, fmt.Sprintf("%s%s%s", remote.Name, separator, branch.Name)) } @@ -167,8 +167,8 @@ func (self *SuggestionsHelper) GetRemoteBranchesSuggestionsFunc(separator string } func (self *SuggestionsHelper) getTagNames() []string { - result := make([]string, len(self.State.Tags)) - for i, tag := range self.State.Tags { + result := make([]string, len(self.getState().Tags)) + for i, tag := range self.getState().Tags { result[i] = tag.Name } return result diff --git a/pkg/gui/working_tree_helper.go b/pkg/gui/working_tree_helper.go index 964a4bc5a..ceca5e0e2 100644 --- a/pkg/gui/working_tree_helper.go +++ b/pkg/gui/working_tree_helper.go @@ -6,17 +6,17 @@ import ( ) type WorkingTreeHelper struct { - fileTreeViewModel *filetree.FileTreeViewModel + getFileTreeViewModel func() *filetree.FileTreeViewModel } -func NewWorkingTreeHelper(fileTreeViewModel *filetree.FileTreeViewModel) *WorkingTreeHelper { +func NewWorkingTreeHelper(getFileTreeViewModel func() *filetree.FileTreeViewModel) *WorkingTreeHelper { return &WorkingTreeHelper{ - fileTreeViewModel: fileTreeViewModel, + getFileTreeViewModel: getFileTreeViewModel, } } func (self *WorkingTreeHelper) AnyStagedFiles() bool { - files := self.fileTreeViewModel.GetAllFiles() + files := self.getFileTreeViewModel().GetAllFiles() for _, file := range files { if file.HasStagedChanges { return true @@ -26,7 +26,7 @@ func (self *WorkingTreeHelper) AnyStagedFiles() bool { } func (self *WorkingTreeHelper) AnyTrackedFiles() bool { - files := self.fileTreeViewModel.GetAllFiles() + files := self.getFileTreeViewModel().GetAllFiles() for _, file := range files { if file.Tracked { return true @@ -40,7 +40,7 @@ func (self *WorkingTreeHelper) IsWorkingTreeDirty() bool { } func (self *WorkingTreeHelper) FileForSubmodule(submodule *models.SubmoduleConfig) *models.File { - for _, file := range self.fileTreeViewModel.GetAllFiles() { + for _, file := range self.getFileTreeViewModel().GetAllFiles() { if file.IsSubmodule([]*models.SubmoduleConfig{submodule}) { return file } diff --git a/pkg/i18n/chinese.go b/pkg/i18n/chinese.go index fc2983dee..ac4e53b1b 100644 --- a/pkg/i18n/chinese.go +++ b/pkg/i18n/chinese.go @@ -66,7 +66,6 @@ func chineseTranslationSet() TranslationSet { LcScroll: "滚动", MergeConflictsTitle: "合并冲突", LcCheckout: "检出", - LcCommitFileFilter: "过滤提交文件", NoChangedFiles: "没有更改过文件", NoFilesDisplay: "没有文件可显示", NotAFile: "不是文件", diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go index ea976b695..c7b31e157 100644 --- a/pkg/i18n/dutch.go +++ b/pkg/i18n/dutch.go @@ -33,7 +33,6 @@ func dutchTranslationSet() TranslationSet { LcPush: "push", LcPull: "pull", LcScroll: "scroll", - LcCommitFileFilter: "Commit dossiers filteren", FilterStagedFiles: "Show only staged files", FilterUnstagedFiles: "Show only unstaged files", ResetCommitFilterState: "Reset commit file state filter", diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 5db081625..711ec02da 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -47,7 +47,6 @@ type TranslationSet struct { LcPull string LcScroll string LcFileFilter string - LcCommitFileFilter string FilterStagedFiles string FilterUnstagedFiles string ResetCommitFilterState string @@ -622,7 +621,6 @@ func EnglishTranslationSet() TranslationSet { MergeConflictsTitle: "Merge Conflicts", LcCheckout: "checkout", LcFileFilter: "Filter files (staged/unstaged)", - LcCommitFileFilter: "Filter commit files", FilterStagedFiles: "Show only staged files", FilterUnstagedFiles: "Show only unstaged files", ResetCommitFilterState: "Reset filter", diff --git a/pkg/i18n/polish.go b/pkg/i18n/polish.go index 13313a165..5ff66f979 100644 --- a/pkg/i18n/polish.go +++ b/pkg/i18n/polish.go @@ -29,7 +29,6 @@ func polishTranslationSet() TranslationSet { LcToggleStagedAll: "przełącz stan poczekalni wszystkich", LcRefresh: "odśwież", LcScroll: "przewiń", - LcCommitFileFilter: "Filtrowanie commitów", FilterStagedFiles: "Pokaż tylko pliki w poczekalni", FilterUnstagedFiles: "Pokaż tylko pliki poza poczekalnią", ResetCommitFilterState: "Resetuj filtr commitów", diff --git a/test/integration/mergeConflictsFiltered/test.json b/test/integration/mergeConflictsFiltered/test.json index 7d6d3b9ca..fc1c9236a 100644 --- a/test/integration/mergeConflictsFiltered/test.json +++ b/test/integration/mergeConflictsFiltered/test.json @@ -1,4 +1,4 @@ { "description": "Verify that when we get merge conflicts we filter out any non-conflicted files", - "speed": 20 + "speed": 1 } diff --git a/vendor/modules.txt b/vendor/modules.txt index ef60705da..61e66d73c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -100,8 +100,6 @@ github.com/gobwas/glob/syntax/ast github.com/gobwas/glob/syntax/lexer github.com/gobwas/glob/util/runes github.com/gobwas/glob/util/strings -# github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 -## explicit # github.com/golang/protobuf v1.3.2 ## explicit # github.com/google/go-cmp v0.5.6 @@ -268,7 +266,6 @@ golang.org/x/sys/windows ## explicit golang.org/x/term # golang.org/x/text v0.3.7 -## explicit golang.org/x/text/encoding golang.org/x/text/encoding/internal/identifier golang.org/x/text/transform