From 8201f3d72f4ec7b68d34400e8b424fdf01a7ef41 Mon Sep 17 00:00:00 2001 From: Alvaro Parker <64918109+AlvaroParker@users.noreply.github.com> Date: Fri, 12 Sep 2025 02:29:20 -0300 Subject: [PATCH] Use \x00 representation instead of literal null characters (#38033) When working on the git stash picker PR (#35927) I notice that my test was detected as a binary file on the git diff view and on GitHub. This was due to the fact that I was using the literal char \0 (instead of a proper representation like `\x00` or `\u{0000}`) character in my test strings. This causes problems with git diff and GitHub's diff viewer, and a reviewer might even assume that the file is corrupted, not viewable or even malicious. Looking at the rest of the codebase, only at `crates/git/src/commit.rs` this character was used, so I replaced it with `\x00` which is a more common representation of the null character in Rust strings. It can also be seen that the PR that introduced this code, can't be viewed properly on Github: https://github.com/zed-industries/zed/pull/27636/files#diff-31114f0b22306b467482573446f71c638277510b442a10e60dd9a8667ccd93c3 Closes #ISSUE Release Notes: - Use `\x00` representation instead of literal null character in strings to improve compatibility with git diff and GitHub's diff viewer. Since the file is not viewable from the "Files changed" tab on Github, this is the changed code: https://github.com/zed-industries/zed/blob/dcd743aca494ec0217a2d7751150ca9e456012f4/crates/git/src/commit.rs#L66-L74 --- crates/git/src/commit.rs | Bin 3571 -> 3625 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/crates/git/src/commit.rs b/crates/git/src/commit.rs index aaacdc038a803a51c02e941daafbe68929333706..1a2aa7b43331aca97e6d9d26bac3569448aafc4a 100644 GIT binary patch delta 339 zcmew?y;5d_C3|E{g@J){Vo`d&UQT{;Hi)OB!=-=(lzc&g$wi4Jsm1yQMfq8&$tC&_ z9VPj>IXHDpw&qgu#wP26#k}I8Wc~Ea61}2gY&sl4f|F&r0AnpyvH$=8 delta 245 zcmZ1}^I3X>CA%Dhb7E0?zFtm#ayEmK4wnKFQ1WG%oWL$Aj7_|dO9@llg<*0bm+<5V z>};5Fj$k?Y^vsg@;*$KLRK22N409oBCVO#6Vd@9E1!VRF4lbN>vb=&=X-n0M{NZIRF3v