Minecraftforge: genPatches on a clean codebase creates modified patches

Created on 7 Jan 2018  路  8Comments  路  Source: MinecraftForge/MinecraftForge

When I execute 'genPatches' on a clean instance of forge (freshly cloned, no file modifications whatsoever) 2 patch files are modified. I've created a commit here that contains these diffs.

Is there something wrong with my workspace? It seems like no one else has this.

Most helpful comment

I'm going to work on a general cleanup commit today, based on https://github.com/MinecraftForge/MinecraftForge/issues/4618
I'll include this.

All 8 comments

See here. Might be a thing for #4618.

Good to know it isn't just me. But if everybody has this 'issue' then why hasn't the diff been committed yet?

Because it's good practice to not commit patches you did not change

Well I guess that makes sense 馃
But would it also be bad practice to create a "sync" commit in the main repo to make the patch match the actual file?

I'm going to work on a general cleanup commit today, based on https://github.com/MinecraftForge/MinecraftForge/issues/4618
I'll include this.

But would it also be bad practice to create a "sync" commit in the main repo to make the patch match the actual file?

I'm kinda new to this but this is how I understand it (correct me if wrong).

You need to be super careful with "merging" patches. Usually in software projects you don't merge patches directly, instead you merge the code and then generate fresh patches. But we can't do that because we can't redistribute the Minecraft source and have to commit patches. So you never see the edits I make to net.minecraft files you only get a patch from me that is supposed to help you recreate it. So if someone messed up a commit of a patch earlier you have no idea what the code was supposed to be.

The dangerous part is that patching relies on line numbers which may then be off due to the patch mismatch. Like if genPatches says that lines 170 to 175 (six lines worth) should be deleted but git says that it was lines 172 to 175 (four lines worth) -- how would you know which is correct and what does that mean for the line numbering for the rest of the file? If you had gone off and also modified the same net.minecraft file at what you thought was line 190 is that really 190 or actually 192? Your line 190 was based on recreating the files using the patch on git.

It is fixable, just tricky mostly because we don't have copies of the contributors' versions of the net.minecraft files so can't just generate fresh set of patches but instead have to recreate the history of changes to patches to see where the mismatch crept in.

Honestly, its a mix of quite a few things. But the 'different patches' are typically just line number changes which can happen for TONS of reasons. It could be slight decompile differences that are yet to be tracked down. But has I dont have any way to reproduce these differences. I dont think I'll be able to solve them. But honestly I think I have solved them all as nobody has reported anything. The other is as others said, merging of PRs sometimes cause misalignment. And honestly its such a trivia issue that it's not a real issue. The mechanisms to apply patches is perfectly capable of having the numbers mismatch. As long as they are within reason. And the rest of the patch matches. There is context included in the patch for this exact reason.
Honestly, its a simple concept. Only PR what you change.

Yeah I agree that it isn't really an issue, was just wondering if there was something wrong with my workspace. Weird that you can't reproduce this though, as it is on a clean clone.

Was this page helpful?
0 / 5 - 0 ratings