git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Patch (apply) vs. Pull

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Jun 23, 2005, 16:45 UTC
Message-ID
<Pine.LNX.4.21.0506231149460.30848-100000@iabervon.org>
In-Reply-To
<Pine.LNX.4.58.0506222258290.11175@ppc970.osdl.org>
On Wed, 22 Jun 2005, Linus Torvalds wrote:
Show 17 quoted lines
> On Thu, 23 Jun 2005, Daniel Barkalow wrote:
> 
> > > In fact, you could probably replace every run of contiguous whitespace
> > > with a single space, and then you'd not have to worry about whitespace
> > > differences either. That would be very simple to do, and quite workable: I
> > > certainly think it sounds more reliable than just hoping that people
> > > always pass on a "patch ID" in their emails..
> > 
> > That's actually quite plausible. The only case it wouldn't handle is when
> > you actually discard parts, and I'm not sure at this point what other
> > people should see there.
> 
> Yes. One small note of warning: different "diff" algorithms may under some
> (mostly unlikely) circumstances result in different patches for the
> difference between the same two files. So when comparin SHA1's of diffs
> this way, you should also hopefully have the same diff generation
> algorithm.

I think that, if we care much about the hashes of diffs, we should hash the diff that's being applied, not hash a regenerated diff (unless, of course, the diff that's being applied has been modified in hash-relevant ways, in which case it's not going to match anything anyway).

GNU diff sometimes generates patches which are really terrible to try to read, because it finds some line of punctuation from a removed block that matches a line in an added block and interleaves unrelated content. It would be nice to not have to worry about confusion if there's a mismatch.

Wouldn't the only case where this would be a problem be if we had the committer apply the patch, generate a diff, hash it, and stick the hash in the commit? The no-cache version has the diffs for hashing done by the same person with the same program, and the hash-the-applied-patch version has the hashes done on the same patch.

Show 9 quoted lines
> > > Yeah. It probably works well in 99% of the cases to just do a simple
> > > "export as patch" + "apply on top with old commit message, author and
> > > author-date".
> > 
> > I think that you'll get better results out of "merge with top" + "commit
> > with old commit info, but not listing old commit as a parent".
> 
> If I understand you correctly, that assumes that you followed the whole
> chain, though, and that there was no cherry-picking.

I think that the whole-chain case is sufficiently common to make special and extra smooth; developers will be making their history forwards every day, and only cherry-picking on occasion.

This is also still in the developer's messy history, and I don't think those commits are really worth much as history or organization (although they're wonderful as checkpointing). The cherry-picking there will generally be content-based rather than commit-based, and will mostly be picking out hunks to form a clean patch sequence to replace the history.

	-Daniel
*This .sig left intentionally blank*
Previous: Linus TorvaldsNext: Linus Torvalds
Message 18 of 33 in “Patch (apply) vs. Pull”
  1. Darrin ThompsonJun 20, 2005
  2. Junio C HamanoJun 20, 2005
  3. Darrin ThompsonJun 20, 2005
  4. Daniel BarkalowJun 21, 2005
  5. Junio C HamanoJun 22, 2005
  6. Catalin MarinasJun 22, 2005
  7. Linus TorvaldsJun 21, 2005
  8. Junio C HamanoJun 22, 2005
  9. Linus TorvaldsJun 22, 2005
  10. Daniel BarkalowJun 22, 2005
  11. Linus TorvaldsJun 22, 2005
  12. Daniel BarkalowJun 22, 2005
  13. Linus TorvaldsJun 22, 2005
  14. Daniel BarkalowJun 23, 2005
  15. Linus TorvaldsJun 23, 2005
  16. Daniel BarkalowJun 23, 2005
  17. Linus TorvaldsJun 23, 2005
  18. Daniel BarkalowJun 23, 2005
  19. Linus TorvaldsJun 23, 2005
  20. Daniel BarkalowJun 23, 2005
  21. Linus TorvaldsJun 23, 2005
  22. Linus TorvaldsJun 23, 2005
  23. Catalin MarinasJun 23, 2005
  24. Daniel BarkalowJun 23, 2005
  25. Catalin MarinasJun 24, 2005
  26. Martin LanghoffJun 23, 2005
  27. Darrin ThompsonJun 22, 2005
  28. Martin LanghoffJun 23, 2005
  29. 0/3 Rebasing for "individual developer" usageJunio C Hamano, Jun 23, 2005
  30. 1/3 git-commit-script: get commit message from an existing one.Junio C Hamano, Jun 23, 2005
  31. 2/3 git-cherry: find commits not merged upstream.Junio C Hamano, Jun 23, 2005
  32. 3/3 git-rebase-script: rebase local commits to new upstream head.Junio C Hamano, Jun 23, 2005
  33. Catalin MarinasJun 22, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.