feat(neojj): add neojj (jujutsu) integration (#187)

This commit is contained in:
Barrett Ruth 2026-03-11 14:02:52 -04:00 committed by GitHub
parent de04381298
commit 0451445966
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 265 additions and 6 deletions

View file

@ -129,6 +129,18 @@ local function get_repo_root(bufnr)
return vim.fn.fnamemodify(neogit_git_dir, ':h')
end
if vim.bo[bufnr].filetype:match('^Neojj') then
local jj_ok, jj_mod = pcall(require, 'neojj.lib.jj')
if jj_ok then
local rok, repo = pcall(function()
return jj_mod.repo
end)
if rok and repo and repo.worktree_root then
return repo.worktree_root
end
end
end
local cwd = vim.fn.getcwd()
local git = require('diffs.git')
return git.get_repo_root(cwd .. '/.')
@ -244,6 +256,10 @@ function M.parse_buffer(bufnr)
or (not logical:match('^deleted file mode') and logical:match('^deleted%s+(.+)$'))
or logical:match('^renamed%s+(.+)$')
or logical:match('^copied%s+(.+)$')
or logical:match('^added%s+(.+)$')
or logical:match('^updated%s+(.+)$')
or logical:match('^changed%s+(.+)$')
or logical:match('^unmerged%s+(.+)$')
local bare_file = not hunk_start and logical:match('^([^%s]+%.[^%s]+)$')
local filename = logical:match('^[MADRCU%?!]%s+(.+)$')
or diff_git_file