delta: 🐛 git add -p one-to-one correspondence errors
When I try to use git add -p, I get the following error:
$ git add -p
fatal: mismatched output from interactive.diffFilter
hint: Your filter must maintain a one-to-one correspondence
hint: between its input and output lines.
I’m using delta with the following config:
$ delta --version
delta 0.4.3
$ delta --show-config
commit-style = raw
file-style = blue
hunk-header-style = syntax
minus-style = syntax 52
minus-non-emph-style = syntax 52
minus-emph-style = syntax 88
minus-empty-line-marker-style = normal 88
zero-style = syntax
plus-style = syntax black
plus-non-emph-style = syntax black
plus-emph-style = syntax 22
plus-empty-line-marker-style = normal 22
whitespace-error-style = reverse magenta
24-bit-color = false
file-added-label = 'added:'
file-modified-label = ''
file-removed-label = 'removed:'
file-renamed-label = 'renamed:'
hyperlinks = false
inspect-raw-lines = true
keep-plus-minus-markers = true
line-numbers = true
line-numbers-minus-style = red
line-numbers-zero-style = brightgreen
line-numbers-plus-style = green
line-numbers-left-style = blue
line-numbers-right-style = blue
line-numbers-left-format = '{nm:^4}⋮'
line-numbers-right-format = '{np:^4}│'
max-line-distance = 0.6
max-line-length = 512
navigate = false
paging = auto
side-by-side = false
syntax-theme = Solarized (dark)
width = 145
tabs = 4
word-diff-regex = '\w+'
In my .gitconfig are the following relevant options:
[core]
pager = delta
[delta]
commit-style = raw
file-style = blue
hunk-header-style = syntax
minus-style = syntax 52
minus-emph-style = syntax 88
zero-style = syntax normal
plus-style = syntax black
plus-emph-style = syntax 22
keep-plus-minus-markers = true
line-numbers = true
line-numbers-minus-style = red
line-numbers-zero-style = brightgreen
line-numbers-plus-style = green
whitespace-error-style = reverse magenta
minus-empty-line-marker-style = normal 88
plus-empty-line-marker-style = normal 22
[interactive]
diffFilter = delta --color-only
[color]
ui = true
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 31 (14 by maintainers)
Commits related to this issue
- Preserve "Binary files" line in color_only mode Closes #320 — committed to imbrish/delta by imbrish 4 months ago
- Preserve "Binary files" line in color_only mode (#1649) Closes #320 — committed to imbrish/delta by imbrish 4 months ago
I can confirm this regressed “recently”, I’ve bisected it down to e0eef7deccc7ca1c56d7c30894985c00898ef8a3
It took me a while to understand why this only happened very rarely, but looking at the commit itself it’s obvious in hindsight – that only happens when I modified some binary files in the repo…!
With that in hand, this can be reproduced as follow:
I’m sure there are better ways of getting
git add -p’s raw output (using tee as a filter or something – EDIT: piping fromgit diffwould apparently have worked…), but I got it from strace and it’s obvious enough from the output (it’s missing the “Binary files a… differ” line):lunchbreak ended so I’ll leave the rest to whoever cares, I’ve downgraded for now 😃
I was using an old version of delta (0.8.2) and today upgraded to 0.15.1. I’ve been able to use
git add -pjust fine until now. All of a sudden I’m getting the above error. I removed thediffFilterconfig from[interactive]and it started working. Could this be a regression or is this still a known issue?I looked for causes of this bug before, and
these options made it happened. @Minnozz 's config can work if you remove file-style one.
@imbrish just in case you want to continue your great work in this area, this bug seems like it might be in your area of expertise? But no worries at all if you don’t have time!
@lithammer Yes, and that is what Delta does, since
0.4.5(Dec 2020). You can’t useside-by-sideof course, since there is then no correspondence with the true git patch, but otherwise delta can be used withgit add -p(% the bug that @imiric is pointing out):@imiric Thanks, I can reproduce your bug – using
boxwithfile-stylecauses the one-to-one-correspondence error (unless you use that strange features workaround).delta --version delta 0.4.4
Thanks a lot @Kr1ss-XD and @ryuta69 for investigating here.
I think @Kr1ss-XD’s suggestion of using features to work around these issues is an excellent one for now, until we fix all the
git app -pbugs.@Kr1ss-XD I’m finding that I have to move both the
file-styleandhunk-header-styleto a feature to make @Minnozz’s config work undergit add -p.So, to be completely explicit, here is a modification of @Minnozz’s config that I am finding works.
@Kr1ss-XD Oh! Same as hunk-header-style, and side-by-side. Moving them to features,
git add -pworks while usualgit diffwork as those options enabled!I think
this is the reason why side-by-side works. I look for file-style, hunk-header-style’s reasons.
I think I found something :
If I put the
file-styleoption in a feature category,git add -pworks with the @Minnozz configuration !cc @dandavison
EDIT The same applies to
hunk-header-style = omit.