Skip to content

[Bug] winbar is not updated correctly and may crash during merge context #615

@dlyongemallo

Description

@dlyongemallo

Description

The "theirs"-side ref name is not displayed in the winbar during a merge. Attempting to stage a file that doesn't exist (because it was deleted on one side) causes a crash in update_merge_context.

Note: I just fixed this in my own fork in dlyongemallo#62 and dlyongemallo#63 - just filing the issue here because this bug is found in this repo too, in case anyone else runs into it.

Expected behavior

The winbar displays the ref names, and attempting to stage a deleted file should do nothing.

Actual behavior

The ref name is not displayed. The plugin crashes when staging the deleted file.

Steps to reproduce

Resolve merge conflicts in which a file has been deleted on one side. Try to stage it.

Health check

(Note: This is from my fork, which implements additional VCS support.)

==============================================================================
diffview: 2 ⚠️

Checking plugin dependencies ~

  • ✅ OK nvim-web-devicons installed.
  • ⚠️ WARNING Optional dependency 'mini.icons' not found.

Checking VCS tools ~

  • The plugin requires at least one of the supported VCS tools to be valid.
  • ✅ OK Jujutsu found.
  • ✅ OK Jujutsu is up-to-date. (0.39.0-d9689cd9b51b4139d2842fcf6c30f65f4eed8cd1)
  • ✅ OK Git found.
  • ✅ OK Git is up-to-date. (2.39.5)
  • ✅ OK Mercurial found.
  • ✅ OK Mercurial is up-to-date. (6.3.2)
  • ⚠️ WARNING Could not connect to Perforce server. Check P4PORT, P4USER, P4CLIENT settings.
    Error: Perforce client error: Connect to server failed; check $P4PORT. TCP connect to perforce:1666 failed. Name or service not known

Log info

N/A

Neovim version

NVIM v0.11.6
Build type: Release
LuaJIT 2.1.1741730670

Operating system and version

Linux 6.1.0-43-amd64 x86_64 GNU/Linux

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