Skip to content

[Bug] Auto-Resolve Remaining Conflicts Based on Last Selection #592

@AlejandroSanchez90

Description

@AlejandroSanchez90

Description

After resolving a file using c - T/O in gitdiff.nvim, switching to the next file (e.g., via tab) causes the plugin to automatically resolve the new file using the last selected option (e.g., THEIRS or OURS), without waiting for user input.

Expected behavior

When using c - T/O in gitdiff.nvim, the chosen resolution (e.g., THEIRS) should apply only to the currently active file.
If I switch to the next file (e.g., by tabbing), the plugin should not auto-resolve that file using the previous option. Instead, it should wait for explicit user input to determine how the conflict should be resolved.

Actual behavior

After resolving a merge conflict in one file using c - T/O, when I tab to the next file, gitdiff.nvim automatically applies the same resolution (THEIRS or OURS).
This happens even if I haven’t pressed the shortcut again — it seems to reuse the last conflict resolution choice across files unintentionally.

I also see an error: failed to create diff buffer

Steps to reproduce

return {
'NeogitOrg/neogit',
dependencies = {
'sindrets/diffview.nvim',
'nvim-lua/plenary.nvim',
},
config = function()
local neogit = require 'neogit'
neogit.setup {}

vim.keymap.set('v', '<leader>gl', "<cmd>'<,'>DiffviewFileHistory<cr>", { desc = 'Line History' })
vim.keymap.set('n', '<leader>go', '<cmd>Neogit<cr>', { desc = 'Open NeoGit' })
-- vim.keymap.set('n', '<leader>gdl', '<cmd>DiffviewFileHistory % --base=LOCAL<cr>', { desc = 'Document Local Diff' })
vim.keymap.set('n', '<leader>gd', '<cmd>DiffviewFileHistory % <cr>', { desc = 'Document History' })
vim.keymap.set('n', '<leader>gh', '<cmd>DiffviewFileHistory<cr>', { desc = 'Branch History' })
vim.keymap.set('n', '<leader>gs', '<cmd>DiffviewOpen<cr>', { desc = 'Current status' })

end,
}

Health check

Output of :checkhealth diffview
#######################
### 
==============================================================================
diffview:                                   require("diffview.health").check()

Checking plugin dependencies ~
- OK nvim-web-devicons installed.

Checking VCS tools ~
- The plugin requires at least one of the supported VCS tools to be valid.
- OK Git found.
- OK Git is up-to-date. (2.39.5)
- WARNING Configured `hg_cmd` is not executable: 'hg'
 ###
#######################

Log info

Relevant info from :DiffviewLog
############################
### PUT LOG CONTENT HERE ###
############################

Neovim version

NVIM v0.11.0
Build type: Release
LuaJIT 2.1.1741730670

Operating system and version

MacOS

Minimal config

-- #######################################
-- ### USAGE: nvim --clean -u mini.lua ###
-- #######################################

local root = vim.fn.stdpath("run") .. "/nvim/diffview.nvim"
local plugin_dir = root .. "/plugins"
vim.fn.mkdir(plugin_dir, "p")

for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

local plugins = {
  { "nvim-web-devicons", url = "https://github.com/nvim-tree/nvim-web-devicons.git" },
  { "diffview.nvim", url = "https://github.com/sindrets/diffview.nvim.git" },
  -- ##################################################################
  -- ### ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE ###
  -- ##################################################################
}

for _, spec in ipairs(plugins) do
  local install_path = plugin_dir .. "/" .. spec[1]
  if vim.fn.isdirectory(install_path) ~= 1 then
    if spec.url then
      print(string.format("Installing '%s'...", spec[1]))
      vim.fn.system({ "git", "clone", "--depth=1", spec.url, install_path })
    end
  end
  vim.opt.runtimepath:append(spec.path or install_path)
end

require("diffview").setup({
  -- ##############################################################################
  -- ### ADD DIFFVIEW.NVIM CONFIG THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE ###
  -- ##############################################################################
})

vim.opt.termguicolors = true
vim.cmd("colorscheme " .. (vim.fn.has("nvim-0.8") == 1 and "habamax" or "slate"))

-- ############################################################################
-- ### ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE ###
-- ############################################################################

print("Ready!")

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions