bamaer opened a new issue, #8887: URL: https://github.com/apache/hop/issues/8887
### What needs to happen? ### What happens With git integration enabled, Hop GUI is unresponsive for several seconds after opening or switching to a project, and editor clicks can be slow afterwards. The delay depends on the size of the git repository the git plugin finds, not on the size of the project. The worst case is the samples project of a client built from source (`assemblies/client/target/hop/config/projects/samples`). That folder has no `.git` of its own. With "search parent folders" enabled, the git plugin walks up and opens the whole Apache Hop source repository, about 24,000 tracked files. Every file in the project is under `target/`, which that repository ignores. ### Cause - `GitGuiPlugin.refreshChangedFiles()` calls `getStagedFiles()`, `getUnstagedFiles()` and `getIgnored()`. Each runs a separate JGit status of the whole repository, on the UI thread. On the Hop repository one refresh takes 2.5–3 s. - Opening a project triggers this refresh three times in a row from the same UI event: in `GitGuiPlugin.rootChanged()`, in `GitCommitPerspective.refresh()`, and in `ExplorerPerspective.refreshEntireTree()` through `beforeRefresh()`. - Every `updateGui()` of a pipeline or workflow editor calls `ExplorerPerspective.updateTreeItem()`. When the file is visible in the explorer tree, that calls `beforeRefresh()` on every refresh listener, which again runs a full git refresh. ### Measurements UI thread sampled every 0.5 s for 75 s after starting Hop GUI on the samples project: | | Time in git on the UI thread | UI thread idle from | |---|---|---| | Git integration on | ~9 s | ~18 s | | Git integration off | 0 | ~9 s | | Git integration on, with the fix | 0 | ~9 s | GC pauses totalled about 100 ms in every run. ### Fix - `UIGit.getFileStatus(path)` returns staged, unstaged and ignored files from a single status. `getStagedFiles()`, `getUnstagedFiles()` and `getIgnored()` return the same results as before. - The status read in `rootChanged()` is reused by the rest of the same UI event: one status on project open instead of three. - A repository found in a parent folder is not used when it ignores the project folder. `UIGit.isIgnored(path)` checks this and only reads the folders on the way to the path. Case-insensitive ignore rules are respected. - New `IExplorerRefreshListener.beforeFileRefresh(filename)`, which by default calls `beforeRefresh()`. `ExplorerPerspective.updateTreeItem()` calls it instead of `beforeRefresh()`. The git plugin then reads the status of that one file, and only when the file changed after the last status. ### Tests New tests in `UIGitTest` and `GitGuiPluginFileStatusTest`: single status matches the three separate calls, status of one file, ignored parent folders (case sensitive and case insensitive), and a per-file refresh that is skipped for an unchanged file and done for a saved one. ### Issue Priority Priority: 2 ### Issue Component Component: Hop Gui -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
