git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: "Robert P. J. Day" <rpjday@crashcourse.ca>,
	Git Mailing list <git@vger.kernel.org>
Subject: Re: can someone verify operation of "splitpatch" with a massive "git diff"?
Date: Tue, 17 Nov 2020 20:51:21 +0100	[thread overview]
Message-ID: <2e422fba-2278-497d-d6a2-909d00aa6ac8@web.de> (raw)
In-Reply-To: <fc5cf6bc-aa74-d8-90b-c1789f349b8c@crashcourse.ca>

Am 16.11.20 um 10:18 schrieb Robert P. J. Day:
>
>   someone just handed me a several thousand line layer-wide patch, and
> i'd like to pull it apart into bite-sized pieces, and i just noticed
> the utility "splitpatch", but when i applied it to the patch, what i
> got was *almost* right ... except that the patch snippets had the
> trailing "git diff" line from the *following* patch snippet in the
> file; the splitting operation clearly retained the trailing line after
> the patch, rather than the leading line that actually represented the
> snippet.
>
>   is there a simple way to do this? i do have the right to go back to
> the patch creator and ask him to redo the diff in a different way.
> thoughts?

patch(1) should ignore those extra lines and apply the diff without
complaint.  git apply is probably more picky, based on the comments on
the homepage of splitpatch [1].

I don't understand how the original patch got so big, what you consider
bite-sized and what you'd do with the pieces, so I may be way off here.
Anyway, sometimes I lump a lot of semi-related changes into a single
commit and then have to split it up when I prepare a patch series for
review.  I'd then run "git reset HEAD^" to get rid of the commit, but
keep the changes in the worktree, and then repeatedly run
"git commit -p" to select just the hunks for a particular topic until
all the changes are committed.  This may be impractical if you have
thousands of hunks to work with, though.

Ideally huge changes are avoided at the source and split into meaningful
and consumable chunks as early as possible.  This is no longer possible
if the source is e.g. a bunch of ancient tar files with monthly
snapshots.  But since it's a Git diff I wonder what happened.  Could
Git have done better?

René


[1] https://www.clearchain.com/blog/posts/splitting-a-patch

      reply	other threads:[~2020-11-17 19:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16  9:18 can someone verify operation of "splitpatch" with a massive "git diff"? Robert P. J. Day
2020-11-17 19:51 ` René Scharfe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2e422fba-2278-497d-d6a2-909d00aa6ac8@web.de \
    --to=l.s.r@web.de \
    --cc=git@vger.kernel.org \
    --cc=rpjday@crashcourse.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).