Closed Gamebuster19901 closed 4 years ago
Some new information - parts of every hunk in a patch file are offset:
Honestly, I think this has more to do with your particular setup then it does on FG/S2S. It's been working for years on all different kinds of setups for everyone else in dev. And obviously I can't reproduce it on my end, so you'll need to try and figure out what on your setup causes it. Try different JVMs/Args/whatever you can think of.
I haven't been able to figure out the exact cause yet, however I have created a reproducible test case:
Steps:
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install git
sudo apt-get install openjdk-8-jdk
git init
git remote add official https://github.com/MinecraftForge/MinecraftForge.git
git pull official/1.15.x
./gradlew setup
./gradlew genPatches
git diff
This is very strange. I just upgraded my cpu, motherboard, and RAM and now I'm no longer able to reproduce this...
I'm just going to go ahead and close this issue instead of figuring out why.
I've been having an issue with forgegradle where
./gradlew genPatches
will add+\ No newline at end of file
in the middle of every .patch file. (Specifically, the last diff hunk of every patch file).After running ./gradlew genPatches, the files in
/forge/build/applyRangeMapBase/output.zip
are all missing new lines at the end of the file, when the originals in/clean/build/applyPatches/output.zip
all have newline characters at the end.ForgeGradle uses diff4j to generate patch files. When diff4j encounters no newline at the last diff hunk it encounters, it will add
+\ No newline at end of file
, and then print the bottom context lines. If the last hunk isn't at the end of the file, it will cause the no newline comment to appear in the middle of the patch file.https://github.com/cloudbees/diff4j/blob/87d621ea70bc8d014d8da11f78b4293142fa8099/src/main/java/com/cloudbees/diff/UnifiedDiff.java#L142-L166
I'd normally submit a PR to fix the issue, but I am unable to build Srg2Source, so I'm unable to debug the issue any further.
My operating system is Ubuntu 18.04.5 LTS
Possibly relates to #34?