wfxr / forgit

:zzz: A utility tool powered by fzf for using git interactively.
MIT License
4.32k stars 136 forks source link

Fix diff preview and edit for files with a ']' character in their name #354

Closed sandr01d closed 4 months ago

sandr01d commented 4 months ago

Check list

Description

Our sed command for removing the short status (e.g. [M]) from gits output to extract the file name with _forgit_diff matched until the last ']' character in the line due to sed being greedy. This created issues with file names that contain a ']' character. To fix this, I made sure that only the short status is removed by sed, independently of the file name. Fixes #353

Type of change

Test environment

sandr01d commented 4 months ago

Off topic but is there any way for us to have unit tests in this project in done kind of structured way? This would be the perfect thing to have a test for to make sure we don't regress. (This is a bigger topic that 100% does not block this review)

That would be great. Did a quick search and this or this GitHub Action look promising (haven't done any in depth research, so I don't know if whether they're any good). Maybe we should create a separate issue for this?

cjappl commented 4 months ago

Yeah these look great! We should definitely open a ticket and we can tackle it when we are able. Good finds.