sindrets / diffview.nvim

Single tabpage interface for easily cycling through diffs for all modified files for any git rev.
Other
4.02k stars 111 forks source link

feat!: Split `log_options` config to allow for other VCS types #271

Closed zegervdv closed 1 year ago

zegervdv commented 1 year ago

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 commented 1 year ago

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.