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

🐛 handle_hunk_header issue in v0.11.0 #826

Closed
mrjoel opened this issue Dec 6, 2021 · 7 comments · Fixed by #827
Closed

🐛 handle_hunk_header issue in v0.11.0 #826

mrjoel opened this issue Dec 6, 2021 · 7 comments · Fixed by #827

Comments

@mrjoel
Copy link

mrjoel commented Dec 6, 2021

Immediately after upgrading to v0.11.0 this morning I get the following error output, so I'm reporting it. This is in my personal dotfiles repo with several working copy changes. If needed, I'll try to reduce down to a minimum reproducer for raw input.

Unexpected state in handle_hunk_header: HunkHeader(Unified, ParsedHunkHeader { code_fragment: "", line_numbers_and_hunk_lengths: [(59, 6), (59, 10)] }, "@@ -59,6 +59,10 @@", "\u{1b}[35m@@ -59,6 +59,10 @@\u{1b}[m") This should not be possible. Please report the bug at https://github.com/dandavison/delta/issues.
@mrjoel
Copy link
Author

mrjoel commented Dec 6, 2021

I encounter this warning when running a git alias I have which includes --color-words in the commandline.

I did find it notable that I get different behavior when running the command normally using pager.diff = delta where I get the warning, but not when I explicitly pipe the output into delta. In summary, for the exact working copy state:

  • git diff - no issue
  • git diff --color-words - shows issue
  • git diff --color-words | delta - no warning reported, but display is also not as expected.

In looking a bit further, perhaps there are two separate issues at play here, the --color-words handling doesn't appear to be passing through the raw as expected from v0.10.3.

@mrjoel
Copy link
Author

mrjoel commented Dec 6, 2021

I confirmed that the --color-words handling in 0.10.3 does work as expected, so for now I've reverted back to that version.

@mrjoel
Copy link
Author

mrjoel commented Dec 6, 2021

With a bit of a closer eye and comparison, the handling of --color-words is not quite what I had expected in v0.10.3 either. I suppose it makes sense given that delta is only passing along the raw values, but for a file with multiple hunks, I'm not getting either line numbers from delta or the hunk headers from the raw git. I'd expect one or the other. Perhaps this, combined with the hunk header handling may a the toxic combination?

Note that I have my delta style using hunk-header-style = omit and line-numbers = true.

@dandavison
Copy link
Owner

Thanks @mrjoel. I agree there are two bugs here. I think I'm going to release a fix for the crash first, since that is unacceptable. But I agree that the "raw" handling of color-words isn't right either and I'll fix that subsequently.

@dandavison
Copy link
Owner

The fix for the crash is released as 0.11.1.

@mrjoel
Copy link
Author

mrjoel commented Dec 6, 2021

Thanks! Should I writeup a separate issue for the second color-words handling or would you like to? I also have a second apparent color-words handling issue I'm running into that I'll writeup.

@dandavison
Copy link
Owner

Should I writeup a separate issue for the second color-words handling

I've opened #829

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

Successfully merging a pull request may close this issue.

2 participants