Skip to content

Conversation

@zegervdv
Copy link
Collaborator

@zegervdv zegervdv commented Dec 15, 2022

These are some required changes to allow the introduction of other VCS types (see #255 ).
It splits the file_history_panel.log_options config table into separate sub-tables per vcs type.

Also includes a couple of refactors to allow a smoother integration.

Breaking changes

The config for log options has changed. In preparation of adding support of other VCS, the table is now divided into sub-tables per VCS type. This allows you to define different default log options for different VCS tools. To update your config, just move all your current log options into the new table key git:

        Before: ~
>
                require("diffview").setup({
                  -- ...
                  file_history_panel = {
                    log_options = {
                      single_file = {
                        max_count = 512,
                        follow = true,
                      },
                      multi_file = {
                        max_count = 128,
                      },
                    },
                  },
                })
<

        After: ~
>
                require("diffview").setup({
                  -- ...
                  file_history_panel = {
                    log_options = {
                      git = {
                        single_file = {
                          max_count = 512,
                          follow = true,
                        },
                        multi_file = {
                          max_count = 128,
                        },
                      },
                    },
                  },
                })
<

@zegervdv
Copy link
Collaborator Author

In the last commit I fixed a little bug in the logging: it is not allowed to call a vim.api or vim.fn function from a callback.

@zegervdv zegervdv marked this pull request as ready for review December 15, 2022 17:30
@sindrets sindrets changed the title Split configuration to allow for other VCS types feat!: Split log_options config to allow for other VCS types Dec 16, 2022
Copy link
Owner

@sindrets sindrets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zegervdv LGTM, thanks!

In the last commit I fixed a little bug in the logging: it is not allowed to call a vim.api or vim.fn function from a callback.

Thanks for catching this! To expand a little on why / when this happens: this only happens in async lua code. So, all libuv callbacks and inside coroutines. You can work around this by using :h vim.schedule(). This will schedule the given function to be run the next time it is safe to call the API.

@sindrets sindrets merged commit a3fc4ae into sindrets:main Dec 16, 2022
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.

2 participants