forgit: diff preview not working on MacOS

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Environment info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:
  • Shell
    • bash
    • zsh
    • fish

Problem / Steps to reproduce

Hello,

I’ve recently ported my forgit configuration from a Linux machine to my MacOS laptop. I’ve noticed previews are not working for the gd command. For example, using the default configuration: Screenshot 2024-03-09 at 13 58 22

Other commands using the same pager, such as ga, seem to work as expected: Screenshot 2024-03-09 at 14 00 27

Did anyone else encounter the same issue?

Cheers

About this issue

  • Original URL
  • State: closed
  • Created 4 months ago
  • Comments: 16

Commits related to this issue

Most upvoted comments

From my limited testing, this seems to occur for every file on MacOS. I was unable to reproduce the issue on Linux as well.

Awesome! Thanks for filing this @giovannilupi and thank you both (@maelp) for testing and reporting back. We appreciate it.

Also works for me, thanks a lot @cjappl

working now, thanks!

@cjappl Thanks for the patch, can confirm this works on Linux too.

Will you apply this to your branch, and we can close this issue when it lands?

I think this should be a separate PR and I see two options here. We could either backport your fix to master now (which I guess should be rather easy, given that it isn’t a big change) and I apply the patch to #326 once I rebase on master or we create a new PR once #326 is merged. I think I would prefer the first option. WDYT?

Any idea how close we are to merging?

Pretty close I think. All the big changes have been reviewed and we should be able to push through the rest quickly. Btw. could you review #361, then I can follow up with the next PR shortly.

This is the first time I’ve worked in that branch and it is SO much easier to reason about, thank you again for taking on that work, huge maintenance improvement.

Awesome, glad to hear 🙂

@cjappl I can not reproduce this on Linux on the current master branch. Does this happen with every preview for gd or just specific files? I think this would be worth fixing this now, as we’d need a similar fix for #326 anyway. My guess would be that we’re using something that GNU sed supports, but the one on macOS does not. Since I don’t have any device running macOS, I guess you’d have to go after this. Doing the fix in #326 is probably easier, since you don’t have to worry about all the issues around escaping characters. For #354 I’ve done the work in #326 first and then backported it to the current master. You’d have to modify the sed commands in _forgit_get_files_from_diff_line and _forgit_get_single_file_from_diff_line. I found this an easier workflow then working in the current master branch directly. I’m attaching a patch to apply #354 to #326 in case you want to go that route.

354.txt