-
For issue 1, a bug is filed: #1856
For issue 2, I can not get it reproduced. Please create a project demonstrating this.
-
With regard to 2:
I did the following so far:
- Checked out a commit before the PR was merged and opened the file in ImHex app. It shows
ühas bytesc3 bcwhich isLATIN SMALL LETTER U WITH DIAERESIS - Checked out a commit after the PR had been merged and operned the file again. It shows
ühas still bytesc3 bc. So the file bytes haven't really changed in that location. - Restored the PR branch in OneDev, checked it out on my host, created a new local branch, pushed it to OneDev and made a new testing PR in OneDev. The issue occurred again in OneDev PR UI. This time the branch has been pushed from a different host and git tool.
- With the testing PR opened I entered the OneDev docker container on the server, navigated to the project and then went to
git/refs/pulls/<id>. I then usedgit-diffto compare commits stored inbaseandheadfiles and the diff DOES NOT show a change in that line. Kind of logical because bytes haven't changed on disk. Still, I see changes in OneDev in that line.
So it seems to be a pure OneDev problem. However I cannot reproduce it manually here in your installation using the OneDev UI. But I can reproduce it using the PR branch in my installation.
The container runs with locale
en_US.UTF-8andjava -XshowSettings:properties -versionalso outputsUTF-8.So no idea how to figure it out, except copying everything and run OneDev from the IDE with breakpoints.
- Checked out a commit before the PR was merged and opened the file in ImHex app. It shows
-
@robin I noticed in my installation the file in question is treated by OneDev as ISO 8859-1 encoded file, even though
üis clearly encoded as UTF-8 bytes (opened it in hex editor). I then used OneDev UI and viewed some files inCode->Filesand it seems OneDev treats some files as ISO 8859-1 and some other files as UTF-8 even though all developers use UTF-8 encoding in their tools. We try to avoid using german umlauts in code so if you guess the encoding based on the content it could very well be that most files can be treated as ISO 8859-1 or UTF-8 because their encoding would be the same. However in string literals or comments we use german umlauts from time to time.So for some reason in the PR in question OneDev uses the file of the PR base commit in UTF-8 encoding (because in the image above the
üis displayed in red) and the pushed changes (PR head) for that file are treated as ISO 8859-1 by OneDev only (git tools do not see any changes, only OneDev). Thus the diff now displays the change forüin OneDev only.How does OneDev detect the file encoding? Is that a setting somewhere? As said before all developer tools and JDK of OneDev container itself use UTF-8 encoding.
-
Please reproduce this with a test OneDev set up, and attach the database and site/projects folder.
-
@robin After looking at your server code the reason is actually relatively simple. See description and code diff (the very last line in the diff): https://code.onedev.io/jbauer/~pulls/3
-
Thanks for the info. Will be fixed in next patch release.
-
Previous Value Current Value Open
Closed
| Type |
Question
|
| Priority |
Normal
|
| Assignee | |
| Labels |
No labels
|
After upgrading to 10.4.0 I noticed two strange code diff behaviors in our pull requests.
Maybe some libraries or Java version has been updated in OneDev server docker container that cause this?