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

Re: [ANNOUNCE] pg - A patch porcelain for GIT

From
CMCatalin Marinas <catalin.marinas@gmail.com>
Date
Feb 15, 2006, 17:12 UTC
Message-ID
<b0943d9e0602150912h55fb87d0r@mail.gmail.com>
In-Reply-To
<20060214045618.GA12844@spearce.org>
On 14/02/06, Shawn Pearce <spearce@spearce.org> wrote:
> Catalin Marinas <catalin.marinas@arm.com> wrote:
> > > - Automatic detection (and cancellation) of returning patches.
[...]
Show 9 quoted lines
> > StGIT has been doing this from the beginning. You would need to run a
> > 'stg clean' after a rebase (or push). I prefer to run this command
> > manually so that 'stg series -e' would show the empty patches and let
> > me decided what to do with them.
>
> Actually StGIT didn't do this correctly for one of my use cases
> and that's one of the things that drove me to trying to write pg
> (because I wondered if there was a way to resolve it automatically).
> Try building a patch series such as:
[...]
> StGIT seemed to not handle this when it tried to reapply the two
> already applied patches.  A won't apply because the file coming
> down is actually A+B, not A's predecessor and not A.  B won't apply
> because the file also isn't A (B's predecessor).

You are right, if two patches modify the same line and both were merged upstream, the three-way merging would report a conflict for the first patch and maybe the second (depending on how the first conflict was resolved).

Show 5 quoted lines
> pg resolves this by attempting to automatically fold patches during
> a pg-rebase (equiv. of stg pull).  If a patch fails to push cleanly
> and there's another patch immediately behind it which also should
> be reapplied pg aborts and retries pushing the combination of the
> patches.  This fixes my A+B case quite nicely during a rebase.  :-)

But what would happen if there was a third-party patch that's modifying the same line? A+B application would fail in this case. Does pg go back to only apply A and report a conflict?

There is another problem with this approach if you have tens of patches. Would pg try to fold all of them?

Some time ago I had a look at Darcs and its patch theory (patch commuting). Their approach to conflicts was to include the conflicts in patch A and propagate them to the last patch to be merged. It's like creating two versions of the conflicting hunk, one of them corresponding to the local tree (that in patch A) and the other to the upstream tree. Merging patch B is only done in the local hunk in the end both conflicting hunks would be identical and one of them removed.

While the above algrithm seems to work OK in Darcs (but quite resource intensive), it's pretty hard to implement and I don't think it's worth for a small number of cases this could occur.

-- Catalin

Previous: Catalin MarinasNext: Shawn Pearce
Message 53 of 54 in “[ANNOUNCE] pg - A patch porcelain for GIT”
  1. Shawn PearceFeb 10, 2006
  2. Greg KHFeb 10, 2006
  3. Shawn PearceFeb 10, 2006
  4. Greg KHFeb 10, 2006
  5. Petr BaudisFeb 10, 2006
  6. Shawn PearceFeb 10, 2006
  7. Petr BaudisFeb 10, 2006
  8. Junio C HamanoFeb 10, 2006
  9. Petr BaudisFeb 13, 2006
  10. Catalin MarinasFeb 14, 2006
  11. Karl HasselströmFeb 14, 2006
  12. Chuck LeverFeb 14, 2006
  13. Karl HasselströmFeb 14, 2006
  14. Chuck LeverFeb 14, 2006
  15. Petr BaudisFeb 14, 2006
  16. Sam VilainFeb 15, 2006
  17. Shawn PearceFeb 15, 2006
  18. Petr BaudisFeb 15, 2006
  19. J. Bruce FieldsFeb 15, 2006
  20. Shawn PearceFeb 15, 2006
  21. J. Bruce FieldsFeb 15, 2006
  22. Junio C HamanoFeb 16, 2006
  23. Catalin MarinasFeb 16, 2006
  24. Fernando J. PeredaFeb 16, 2006
  25. Junio C HamanoFeb 16, 2006
  26. Catalin MarinasFeb 16, 2006
  27. Catalin MarinasFeb 15, 2006
  28. Karl HasselströmFeb 16, 2006
  29. 0/2 stg uncommitKarl Hasselström, Feb 17, 2006
  30. 1/2 Update .git/refs/heads/base after patch deletionKarl Hasselström, Feb 17, 2006
  31. 2/2 Add 'stg uncommit' commandKarl Hasselström, Feb 17, 2006
  32. Catalin MarinasFeb 19, 2006
  33. Karl HasselströmFeb 19, 2006
  34. Karl HasselströmFeb 19, 2006
  35. Sam VilainFeb 19, 2006
  36. Catalin MarinasFeb 20, 2006
  37. Karl HasselströmFeb 20, 2006
  38. Catalin MarinasFeb 20, 2006
  39. Karl HasselströmFeb 21, 2006
  40. Karl HasselströmFeb 15, 2006
  41. Andreas EricssonFeb 15, 2006
  42. Karl HasselströmFeb 15, 2006
  43. Karl HasselströmFeb 15, 2006
  44. Catalin MarinasFeb 17, 2006
  45. Sam VilainFeb 13, 2006
  46. Shawn PearceFeb 13, 2006
  47. Sam VilainFeb 13, 2006
  48. Shawn PearceFeb 13, 2006
  49. Catalin MarinasFeb 13, 2006
  50. Shawn PearceFeb 14, 2006
  51. Shawn PearceFeb 14, 2006
  52. Catalin MarinasFeb 15, 2006
  53. Catalin MarinasFeb 15, 2006
  54. Shawn PearceFeb 15, 2006

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.