vim-fugitive icon indicating copy to clipboard operation
vim-fugitive copied to clipboard

Gstatus: silently ignores binary files with inline diffs

Open blueyed opened this issue 6 years ago • 2 comments

Having an unstaged changed file, where Git reports the differences as binary silently does nothing when using = to see the inline diff.

From debugging:

>echo info
{'sigil': '', 'status': 'M', 'heading': 'Unstaged (1)', 'section': 'Unstaged', 'sub': 'N...', 'offset': -1, 'paths': ['…/Vcs/neovim/.vim-src/src/testdir/test42.in'
], 'index': 1, 'relative': ['src/testdir/test42.in'], 'commit': '', 'filename': 'src/testdir/test42.in'}
line 24: endif
line 25: if getline(lnum + 1) =~# '^[ @\+-]'
line 37: endif
line 38: if !has_key(b:fugitive_diff, info.section) || info.status !~# '^[ADMRU]$' || a:mode ==# 'hide'
>echo b:fugitive_diff
{'Unstaged': ['diff --git src/testdir/test42.in src/testdir/test42.in', 'index c35569a76..438a48055 100644', 'Binary files src/testdir/test42.in and src/testdir/test42.in dif
fer'], 'Staged': []}
>
:return ['# branch.oid 1142a31b8c44c4e7dbf28a83ae52995113b37917^A# branch.head master^A# branch.upstream origin/master^A# branch.ab +0 -0^A1 .M N... 100644 100644 100644 c355
69a76c908682eb8e7e7ab8d9a3522d9fa473 c35569a76c908682eb8e7e7ab8d9a3522d9fa473 src/testdir/test42.in^A', 0] made pending
:return ['# branch.oid 1142a31b8c44c4e7dbf28a83ae52995113b37917^A# branch.head master^A# branch.upstream origin/master^A# branch.ab +0 -0^A1 .M N... 100644 100644 100644 c355
69a76c908682eb8e7e7ab8d9a3522d9fa473 c35569a76c908682eb8e7e7ab8d9a3522d9fa473 src/testdir/test42.in^A', 0] resumed
:return ['', 0] made pending
:return ['', 0] resumed
:return ['', 0] made pending
:return ['', 0] resumed
:return ['diff --git src/testdir/test42.in src/testdir/test42.in^@index c35569a76..438a48055 100644^@Binary files src/testdir/test42.in and src/testdir/test42.in differ^@', 0
] made pending
:return ['diff --git src/testdir/test42.in src/testdir/test42.in^@index c35569a76..438a48055 100644^@Binary files src/testdir/test42.in and src/testdir/test42.in differ^@', 0
] resumed
:return  made pending
:return  resumed

dp shows:

diff --git i/src/testdir/test42.in w/src/testdir/test42.in
index c35569a76..438a48055 100644
Binary files i/src/testdir/test42.in and w/src/testdir/test42.in differ

It would be nice if there was some kind of feedback/indicator in that case, e.g. a "(binary)" after the filename then (after running the diff).

blueyed avatar Oct 17 '19 00:10 blueyed

I'm leaning towards doing :echo "Binary file" on attempting to expand, as I find putting stuff after the file name makes it a bit (just a bit) harder to scan.

tpope avatar Oct 17 '19 03:10 tpope

The same problem exists for submodules currently

odnoletkov avatar Oct 17 '19 09:10 odnoletkov