{"thread":{"id":"54650","subject":"can someone verify operation of \"splitpatch\" with a massive \"git diff\"?","startedAt":"2020-11-16T11:05:46Z","lastAt":"2020-11-17T19:52:09Z","messageCount":2,"participants":["Robert P. J. Day","René Scharfe"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"409982","messageId":"fc5cf6bc-aa74-d8-90b-c1789f349b8c@crashcourse.ca","threadId":"54650","inReplyTo":null,"subject":"can someone verify operation of \"splitpatch\" with a massive \"git diff\"?","fromName":"Robert P. J. Day","fromEmail":"rpjday@crashcourse.ca","sentAt":"2020-11-16T09:18:24Z","receivedAt":"2020-11-16T11:05:46Z","isPatch":false,"sender":{"key":"rpjday@crashcourse.ca","avatar":"https://avatars.githubusercontent.com/u/226084077?v=4"},"body":"\n  someone just handed me a several thousand line layer-wide patch, and\ni'd like to pull it apart into bite-sized pieces, and i just noticed\nthe utility \"splitpatch\", but when i applied it to the patch, what i\ngot was *almost* right ... except that the patch snippets had the\ntrailing \"git diff\" line from the *following* patch snippet in the\nfile; the splitting operation clearly retained the trailing line after\nthe patch, rather than the leading line that actually represented the\nsnippet.\n\n  is there a simple way to do this? i do have the right to go back to\nthe patch creator and ask him to redo the diff in a different way.\nthoughts?\n\nrday\n"},{"id":"410121","messageId":"2e422fba-2278-497d-d6a2-909d00aa6ac8@web.de","threadId":"54650","inReplyTo":"fc5cf6bc-aa74-d8-90b-c1789f349b8c@crashcourse.ca","subject":"Re: can someone verify operation of \"splitpatch\" with a massive \"git diff\"?","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2020-11-17T19:51:21Z","receivedAt":"2020-11-17T19:52:09Z","isPatch":false,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 16.11.20 um 10:18 schrieb Robert P. J. Day:\n>\n>   someone just handed me a several thousand line layer-wide patch, and\n> i'd like to pull it apart into bite-sized pieces, and i just noticed\n> the utility \"splitpatch\", but when i applied it to the patch, what i\n> got was *almost* right ... except that the patch snippets had the\n> trailing \"git diff\" line from the *following* patch snippet in the\n> file; the splitting operation clearly retained the trailing line after\n> the patch, rather than the leading line that actually represented the\n> snippet.\n>\n>   is there a simple way to do this? i do have the right to go back to\n> the patch creator and ask him to redo the diff in a different way.\n> thoughts?\n\npatch(1) should ignore those extra lines and apply the diff without\ncomplaint.  git apply is probably more picky, based on the comments on\nthe homepage of splitpatch [1].\n\nI don't understand how the original patch got so big, what you consider\nbite-sized and what you'd do with the pieces, so I may be way off here.\nAnyway, sometimes I lump a lot of semi-related changes into a single\ncommit and then have to split it up when I prepare a patch series for\nreview.  I'd then run \"git reset HEAD^\" to get rid of the commit, but\nkeep the changes in the worktree, and then repeatedly run\n\"git commit -p\" to select just the hunks for a particular topic until\nall the changes are committed.  This may be impractical if you have\nthousands of hunks to work with, though.\n\nIdeally huge changes are avoided at the source and split into meaningful\nand consumable chunks as early as possible.  This is no longer possible\nif the source is e.g. a bunch of ancient tar files with monthly\nsnapshots.  But since it's a Git diff I wonder what happened.  Could\nGit have done better?\n\nRené\n\n\n[1] https://www.clearchain.com/blog/posts/splitting-a-patch\n"}]}