fix: gate ft=git attachment on fugitive config toggle (#163)

## Problem

The `is_fugitive_buffer` guard in the `FileType` callback checked the
buffer name for `fugitive://` without checking whether the `fugitive`
integration was enabled. `ft=git` fugitive buffers got highlighted even
with `fugitive = false` (the default).

## Solution

Check `get_fugitive_config()` before `is_fugitive_buffer()`. When
`fugitive = false` (default), no `ft=git` buffer gets through the guard.
This commit is contained in:
Barrett Ruth 2026-03-06 11:13:53 -05:00 committed by GitHub
parent 993fed4a45
commit b2fb49d48b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,9 +22,11 @@ vim.api.nvim_create_autocmd('FileType', {
pattern = require('diffs').compute_filetypes(vim.g.diffs or {}),
callback = function(args)
local diffs = require('diffs')
if args.match == 'git' and not diffs.is_fugitive_buffer(args.buf) then
if args.match == 'git' then
if not diffs.get_fugitive_config() or not diffs.is_fugitive_buffer(args.buf) then
return
end
end
diffs.attach(args.buf)
if args.match == 'fugitive' then