-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
[Bug] Retrieving Abbreviated HEAD Revision for feline.nvim
Winbar Integration
#433
Comments
This is related to a bug in our async lib. Basically - without going into too much detail - there is a wait operation being invoked here that is supposed to be blocking, but it isn't fully. This leads to LibUV's scheduler progressing onto other scheduled tasks, that then run into problems because the editor is still in a semi-locked state. I have fixed this locally in a local branch where I'm refactoring the async lib. Unfortunately, that refactor isn't ready yet, and the fix needed here is not trivial. This issue also does not arise during normal usage of the plugin, and due to me having little time to work on the plugin lately, this will probably not be fixed any time soon. Sorry about that. |
Thank you for providing clarification. I appreciate your assistance in helping me understand the nature of this bug. I'm doing the system call myself as workaround, which alleviates the issue for now. Given that, there's no immediate urgency to address this on your end. Feel free to close this issue if there are no plans to fix it. Thanks again |
It will be fixed. Like I said, I have already addressed this issue in local development branch. I just don't know when I'll have time to finish the refactor that includes the fix. We can leave this issue open until the refactor comes around. |
Hello Sindrets, I currently have the following code snippet in my configuration to generate the text for my winbar, and it's working well. However, I believe this feature could be of interest to other users as well, and the existing code involves a lot of customization and boilerplate. local view = require('diffview.lib').get_current_view()
local bufnr = vim.api.nvim_get_current_buf()
local rev_label = ''
local path = ''
for _, file in ipairs(view.cur_entry and view.cur_entry.layout:files() or {}) do
if file:is_valid() and file.bufnr == bufnr then
path = string.format('%s/%s', view.adapter.ctx.toplevel, file.path)
local rev = file.rev
if rev.type == 1 then
rev_label = 'LOCAL'
elseif rev.type == 2 then
local head = vim.trim(vim.fn.system(
{'git', 'rev-parse', '--revs-only', 'HEAD'}))
if head == rev.commit then
rev_label = 'HEAD'
else
rev_label = string.format('%s', rev.commit:sub(1, 7))
end
elseif rev.type == 3 then
rev_label = ({
[0] = 'INDEX',
[1] = 'MERGE COMMON ANCESTOR',
[2] = 'MERGE OURS',
[3] = 'MERGE THEIRS',
})[rev.stage] or ''
end
end
end
if rev_label == '' then
return path
else
return string.format('%s on %s', path, rev_label)
end I'm wondering if it would be possible to provide an API function that allows users to access winbar information more easily. Here's a possible function signature: require('diffview').get_winbar_info(win_id) The function would return the following (or a similar) dictionary: {
file_path = string, -- PATH
type = string, -- LOCAL|COMMIT|STAGE
commit_hash = string, -- HASH|nil
head = bool, -- true|false
stage_number = int, -- 0|1|2|3|nil
} I'm aware of the |
Description
I have chosen to create a new issue based on #251. This decision stems from my efforts to pinpoint the problem and construct a minimal configuration that reliably reproduces the error.
I want to get the abbreviated revision object name for HEAD and show it in my
winbar
. The winbar is generated by feline.nvimThe following code errors if it is run inside a feline provider function:
Expected behavior
The abbreviated revision object name is shown in my winbar
Actual behavior
E565: Not allowed to change text or change window
Steps to reproduce
nvim --clean -u mini.lua
:cd <random git repo>
:DiffviewOpen
Health check
Output of
:checkhealth diffview
Log info
Relevant info from
:DiffviewLog
Neovim version
Operating system and version
Darwin 22.5.0 arm64
Minimal config
The text was updated successfully, but these errors were encountered: