Skip to content

feat: rewrite git management with sqlite #682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from

Conversation

kyazdani42
Copy link
Member

@kyazdani42 kyazdani42 commented Oct 3, 2021

use tami5/sqlite.lua to store git informations.
Run git small commands in vim.fn.system and run git status retrieval in a libuv job.
This allows to fetch millions of statuses and add them partially in the database to avoid destroying the lua memory with huge tables.
The paths can then be retrieved partially to apply updates.
partially addresses #549 and more i guess.

Also will allow for extending the git integration once renderer will be refactored. It'd be nicer to have more configuration over git display.

EDIT 11/10: also did some cleanup on the lib file, just noticed that a lot of reload are unecessary. I will need to rewrite the reload logic to avoid redrawing multiple times.

next steps:

  • add a toggle function to allow for fast git disabling if it takes too long -> will do in another PR, this is not urgent

add a timeout value for now to prevent for huge amount of git statuses destroying the UI

rejected:

  • fix bug that sometimes happen when opening nvim and sqlite cannot connect for some reason. [Rejected]
    cannot reproduce the bug anymore, i changed the random impl to return a proper number string to avoid weird characters in filename that could potentially cause issues.

to do:

  • make sure this works on windows and macos too.
  • there is a flicker when reloading because at least 2 redraws are made after each tree refresh (or more depending on the number of git repositories indexed). Not sure there is a way to address this correctly for now.

@kyazdani42 kyazdani42 force-pushed the feat/rewrite-git-with-sqlite branch 4 times, most recently from e556685 to 2a5cd54 Compare October 10, 2021 09:59
@kyazdani42 kyazdani42 force-pushed the feat/rewrite-git-with-sqlite branch from 56c231f to 2237204 Compare October 10, 2021 13:50
kyazdani42 referenced this pull request Oct 10, 2021
Colors groups and icons are now in diagnostics.lua. They are defined on
setup which allows an easier configuration and better documentation.
`lsp_diagnostics` boolean value has been moved into a table `diagnostics`
with `enable` and `icons` as properties.
@kyazdani42 kyazdani42 force-pushed the feat/rewrite-git-with-sqlite branch 3 times, most recently from 9650314 to e389812 Compare October 16, 2021 15:56
@kyazdani42 kyazdani42 mentioned this pull request Oct 16, 2021
@kyazdani42 kyazdani42 force-pushed the feat/rewrite-git-with-sqlite branch from 078a555 to 499e233 Compare October 20, 2021 17:09
use `tami5/sqlite.nvim` to store git informations. Run git small
commands in system and run git status management in a libuv job. This
allows to fetch millions of status and add them partially in the
database to avoid destroying the lua memory with huge tables. The paths
can then be retrieved partially to apply updates.
also fix toggle ignored/hidden by disabling the clock
also fix git ignore impl (recursive)
@kyazdani42 kyazdani42 force-pushed the feat/rewrite-git-with-sqlite branch from 499e233 to bb320f9 Compare October 23, 2021 14:55
also fix many small issues in lib regarding redraw logic, and remove the
old M.Tree.loaded logic that wasn't useful and also remove some overkill
redraw calls with full reload.
also refactor some code, remove match_name match_path properties from
nodes because they are basically useless, better to use `vim.fn.stridx`
do not redraw when applying updates on git, only redraw when a new
project is indexed.
@kyazdani42
Copy link
Member Author

closing because sqlite was too complex to handle compared to just running the job with a timeout.
See #743

@kyazdani42 kyazdani42 closed this Oct 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant