Wilfred / difftastic

a structural diff that understands syntax 🟥🟩
https://difftastic.wilfred.me.uk/
MIT License
21.04k stars 345 forks source link

Difftastic reports 'no changes' when a new blank file is added to git #259

Open Wilfred opened 2 years ago

FranklinYu commented 1 year ago

This is also the case when an empty file is removed from the repository. I think a better message would be “empty file added” or “empty file removed”.

nimrodkor commented 3 months ago

Would love to contribute a fix here @Wilfred . There are a few ways about this:

  1. I can extend the extra_info to catch also added / deleted files (currently the try_into fails there) and then parse the header on-the-fly when we print it out.
  2. I can add the file status as more fields for diff_file_content (which has enough params as is if I may say so).
  3. I can refactor the read_or_die to return an Option<Vec<u8>>, as None means there is no file and an empty vec means the file exists, but is empty

Thoughts?