-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Speed up rebuilding patches and reduce diff #2324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No on the zero commit. causes huge problems when doing upstream updates (git uses that data to help apply patches when the line numbers no longer line up), but the other things are nice.
As far as I know, only the The commit hash in It is not very helpful when applying the patch. The reason is that only the person that generated the patch will eventually still have that commit hash in their local repository. Every time the patch is applied a new commit hash is generated. I'm quite sure that commit hash is simply ignored when applying the patch... |
|
I thought the same too, and git surprised me. git uses the hashes to build a cross reference lookup "This patch 0003 references a non existent commit ID, but I have record of a previous patch 0001 using this ID that ended up being applied as this other ID, so use this ID as the base instead" though i don't know how much thats tied to commit vs file hashes, but i don't see it as worth the risk, as you don't know how much it bites you until the next upstream update and stuff fails to apply that would have otherwise. |
|
I can imagine that it does a lot of magic with the The |
|
I'm not convinced that first |
|
I'll try to run through some scenarios later this week (oh god I'm giving out time frames again) to confirm that this shouldn't cause any glaring issues. |
|
I've had local issues specifically with I will be looking into taking this issue to git over the next week or so, but decided to comment here to let anyone know who is using these flags to perhaps be aware of issues and a solution. |
|
@Spottedleaf That doesn't really make sense. I'm not sure if I understand the issue you have, but if your issue is that new changes don't show up in the regenerated patches you might want to check if the |
|
While From may not be needed, as we've demonstrated, the rest are absolutely required, so we're talking about simply 1 set of hashes per file. Not worth the complexity over a single extra diff section especially if the solution provided, Leaf has mentioned has problems. |
|
What complexity? No arm chair quarterbacking in this. Either you have issues or you don’t. Leafs issue remains an open question. No changes required at this time. |
|
@aikar |
|
@Spottedleaf is this just some generic issue with rebuilds on these patches or is there some specific case you’ve narrowed it too? Would like to see if we can get some reproduction on it and go from there. |
|
Oh yes that flag is good, I had been meaning to look into why that problem was happening ages ago. |
|
@zachbr the issue stems that if someone builds on an older repo that has more stale/temp objects in it, and that git actually encounters a short hash conflict, it adds 1 more character to the shorthash to overcome the conflict. So people on fresh repos would nearly always result in a standard shorthash, but occasionally older checkouts might have an object conflict resulting in other patch files getting changed in a way that cleanupPatches can't filter out. |
|
Cleanup patches is reverting the patches |
|
The specific issue was fixed here: |
|
With this PR, pretty much none of |
|
edit: nevermind, I swear I thought I saw zero-commit erased index lines too, but I see it doesn't now. (got confused on some actual new file adds where source = 00000, thinking that was all index lines) Ok, does look like that's fine then. |
|
I think cleanup will still be needed, as otherwise a change of a lower file will result in the index lines of every subsequent patch changing, generating more noise instead of reducing it. |
|
I ran into some issues a while ago with patches again not rebuilding correctly - decided to cut cleanup patches entirely and I've not run into further issues. |
Add --zero-commit --full-index --no-signature to git format-patch to reduce the diff when doing minor changes in patches. --zero-commit: Print 00000000... commit hash in first "From" line of the patch. This commit hash is useless because it changes every time the patch is applied. --full-index: Print full SHA-1 hash on "index aaaa..bbbb" lines. This makes the lines much longer, but avoids random changes to add/remove a character based on the number of objects that exist in the local repository. --no-signature: Omit Git version from generated patches.
I was looking the the
git format-patchman page a while ago and thought these extra command line parameters might help to reduce the ugly random diff when regenerating patches.See commit description for details.
Regenerated patches with these changes: https://github.com/Minecrell/Paper/commit/410eaf85a776aaf3476aff12725897fab7ea768e
Eventually, some parts of
cleanupPatchescould be removed after this change.