Skip to content
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

🐛 [Linux] git add -p not working with side-by-side #274

Closed
msirringhaus opened this issue Aug 5, 2020 · 9 comments
Closed

🐛 [Linux] git add -p not working with side-by-side #274

msirringhaus opened this issue Aug 5, 2020 · 9 comments

Comments

@msirringhaus
Copy link
Contributor

System: openSUSE Tumbleweed, self-packaged delta as git-delta (because of naming conflicts).
Happens for delta 0.3 and 0.4

My gitconfig:

[core]
    pager = git-delta

[interactive]
    diffFilter = git-delta --color-only

[delta]
    features = side-by-side line-numbers
    light = true

My diff:

 /* Disable DoH by default */
 pref("network.trr.mode", 5);
-// do not disable system-global or app-global extensions
-pref("extensions.autoDisableScopes", 3);
+// do not disable any scope
+pref("extensions.autoDisableScopes", 0);
 pref("extensions.shownSelectionUI", true);
+pref("extensions.langpacks.signatures.required", false);

Doing git diff works fine, but doing git add -p gives me

fatal: mismatched output from interactive.diffFilter                                                                                                                         
hint: Your filter must maintain a one-to-one correspondence                                                                                                                  
hint: between its input and output lines

If I explicitly set side-by-side = false in .gitconfig -> [delta], it works.

@dandavison
Copy link
Owner

Thanks for this @msirringhaus! The good news is there's a PR in progress for this linked to #258.

@msirringhaus
Copy link
Contributor Author

Ah, perfect. I saw that PR, but didn't realize it was my issue.
Thanks!

@yoichi
Copy link
Contributor

yoichi commented Aug 6, 2020

This is another problem.
side-by-side feature should be disabled with raw/color-only mode.
line-numbers feature can keep the number of total lines, but side-by-side feature cannot (unless adding blank lines or so).

@alfredbez
Copy link

I checked the PR, but it does not solve this issue.

@yoichi
Copy link
Contributor

yoichi commented Aug 8, 2020

@dandavison This issue is not solved by #258.

Its cause is that delta shows modified line (+ line and - line) into 1 line and it violates a requirement for interactive.diffFilter:
https://github.com/git/git/blob/master/add-patch.c#L601

mismatched_output:
		error(_("mismatched output from interactive.diffFilter"));
		advise(_("Your filter must maintain a one-to-one correspondence\n"
			 "between its input and output lines."));

@yoichi
Copy link
Contributor

yoichi commented Aug 8, 2020

I'm sorry. I was missing a fix in
6669e6a

I've confirmed the fixed behavior. Thanks!

@adampetrovic
Copy link

adampetrovic commented Aug 20, 2020

Upgrading to 0.4.1 didn't solve this issue for me.

note the omit hunk-header-style

[delta]
    line-numbers = true
    plus-style = syntax "#003800"
    minus-style = syntax "#3f0001"
    hunk-header-style = omit

[delta "line-numbers"]
    line-numbers-left-style = cyan
    line-numbers-right-style = cyan
    line-numbers-minus-style = 124
    line-numbers-plus-style = 28

[interactive]
    diffFilter = delta --color-only
$ 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.
$ delta --version
delta 0.4.1

If I comment out hunk-header-style = omit it works.

@dandavison
Copy link
Owner

Thanks @adampetrovic. I'll get this fixed. Linking #293 where @iyerusad also made this diagnosis.

@dandavison
Copy link
Owner

Thanks @adampetrovic for that diagnosis. There's good discussion also in #320, which is the same bug. I'm going to close this one to keep discussions in one place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants