push cpp files get as binary files - gerrit 3.6.1 server

236 views
Skip to first unread message

Guy Levkowitz

unread,
Oct 31, 2022, 8:56:51 AM10/31/22
to Repo and Gerrit Discussion
Hi
we have some strange issue when sometimes developers push code of cpp files and it push as Binary and can't be diff 

see attached 

what can cause this issue - is there any solution to change it via Web UI ? 

thanks

Guy

Cpp_files_show_as_Binary_Gerrit_Code_Review.png

Rikard Almgren

unread,
Oct 31, 2022, 9:10:07 AM10/31/22
to Repo and Gerrit Discussion
Not so much a fix via web UI, but it is likely due to CRLF vs LF [1] in the files.
It might require two changes to fix. e.g.

Change 1: Change all CRLF to LF (This will be Binary - Binary diff)
Change 2: Actual code-change to the file (this should show as an actual diff of code)
 
You can set Git to do autocrlf conversions via the core.autocrlf setting. [2]

thanks

Guy



BR
Rikard

Guy Levkowitz

unread,
Oct 31, 2022, 10:15:34 AM10/31/22
to Repo and Gerrit Discussion
Actual code-change to the file (this should show as an actual diff of code)  - where is this code change needed to be done
i have open the file in VS2019  and make it as LF - still when push get the same 

ב-יום שני, 31 באוקטובר 2022 בשעה 15:10:07 UTC+2, Rikard Almgren כתב/ה:

Rikard Almgren

unread,
Oct 31, 2022, 12:32:11 PM10/31/22
to Repo and Gerrit Discussion
On Monday, 31 October 2022 at 15:15:34 UTC+1 sil...@gmail.com wrote:
Actual code-change to the file (this should show as an actual diff of code)  - where is this code change needed to be done
i have open the file in VS2019  and make it as LF - still when push get the same 

To clarify.

Change 1, e.g. Commit 1:
Change to LF

Change 2: Code-change.

2: Code-Change
1: Change to LF
0: Current main

It needs to be done in two separate changes. A single change will not suffice.
The code-change needs to be on top of the change to LF.

We had this issue on our 3.6.1 instance as well, and this is how we fixed it,
However, I currently can't reproduce the binary file issue. So I can't find a way to showcase the fix.

Unfortunately I don't have any other ideas on how to resolve it if it does not work for you.

Kenyon Ralph

unread,
Nov 2, 2022, 4:06:22 AM11/2/22
to Repo and Gerrit Discussion
I have seen this also with UTF-16 files, or UTF-8 files with byte order mark (I don't remember which). These tend to be created on Windows systems.

David Ostrovsky

unread,
Nov 7, 2022, 12:37:48 PM11/7/22
to Repo and Gerrit Discussion
Yes, this is a known issue with MS Visual Studio and UTF-16 encoding, see:

 
Reply all
Reply to author
Forward
0 new messages