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

Re: [PATCH] rebase --merge: optionally skip upstreamed commits

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Mar 12, 2020, 18:04 UTC
Message-ID
<20200312180427.192096-1-jonathantanmy@google.com>
In-Reply-To
<20200310225641.96556-1-jonathantanmy@google.com>
Show 13 quoted lines
> > Does this suggest that the cherry-pick detection is suboptimal and
> > needs to be improved?  When rebasing, it is typical that you are just
> > rebasing a small number of patches compared to how many exist
> > upstream.  As such, any upstream patch modifying files outside the set
> > of files modified on the rebased side is known to not be PATCHSAME
> > without looking at those new files.
> 
> That's true - and this would drastically reduce the fetches necessary in
> partial clone, perhaps enough that we no longer need this check.
> 
> In the absence of partial clone, this also might improve performance
> sufficiently, such that we no longer need my new option. (Or it might
> not.)

I took a further look at this. patch-ids.c and its caller (cherry_pick_list() in revision.c) implement duplicate checking by first generating full diff outputs for the commits in the shorter side, putting them in a hashmap keyed by the SHA-1 of the diff output (and values being the commit itself), and then generating full diff outputs for the commits in the longer side and checking them against the hashmap. When processing the shorter side, we could also generate filename-only diffs and put their hashes into a hashset; so when processing the longer side, we could generate the filename-only diff first (without reading any blobs) and checking them against our new hashset, and only if it appears in our new hashset, then do we generate the full diff (thus reading blobs).

One issue with this is unpredictability to the user (since which blobs get read depend on which side is longer), but that seems resolvable by not doing any length checks but always reading the blobs on the right side (that is, the non-upstream side).

So I would say that yes, the cherry-pick detection is suboptimal and could be improved. So the question is...what to do with my patch? An argument could be made that my patch should be dropped because an improvement in cherry-pick detection would eliminate the need for the option I'm introducing in my patch, but after some thought, I think that this option will still be useful even with cherry-pick detection. If we move in a direction where not only blobs but also trees (or even commits) are omitted, we'll definitely want this new option. And even if a user is not using partial clone at all, I think it is still useful to suppress both the filtering of commits (e.g. when upstream has a commit then revert, it would be reasonable to cherry-pick the same commit on top) and reduce disk reads (although I don't know if this will be the case in practice).

Previous: Jonathan TanNext: Elijah Newren
Message 8 of 36 in “rebase --merge: optionally skip upstreamed commits”
  1. rebase --merge: optionally skip upstreamed commitsJonathan Tan, Mar 9, 2020
  2. Taylor BlauMar 10, 2020
  3. Jonathan TanMar 10, 2020
  4. Johannes SchindelinMar 10, 2020
  5. Jonathan TanMar 10, 2020
  6. Elijah NewrenMar 10, 2020
  7. Jonathan TanMar 10, 2020
  8. Jonathan TanMar 12, 2020
  9. Elijah NewrenMar 12, 2020
  10. Elijah NewrenMar 14, 2020
  11. Jonathan TanMar 17, 2020
  12. rebase --merge: optionally skip upstreamed commitsJonathan Tan, Mar 18, 2020
  13. Junio C HamanoMar 18, 2020
  14. Jonathan TanMar 18, 2020
  15. Junio C HamanoMar 18, 2020
  16. Elijah NewrenMar 18, 2020
  17. Junio C HamanoMar 18, 2020
  18. Elijah NewrenMar 19, 2020
  19. Junio C HamanoMar 18, 2020
  20. Jonathan TanMar 26, 2020
  21. Elijah NewrenMar 26, 2020
  22. Junio C HamanoMar 26, 2020
  23. rebase --merge: optionally skip upstreamed commitsJonathan Tan, Mar 30, 2020
  24. Junio C HamanoMar 30, 2020
  25. Danh DoanMar 30, 2020
  26. Derrick StoleeMar 30, 2020
  27. Junio C HamanoMar 30, 2020
  28. Jonathan TanMar 30, 2020
  29. Derrick StoleeMar 31, 2020
  30. Elijah NewrenMar 31, 2020
  31. Junio C HamanoMar 31, 2020
  32. Junio C HamanoMar 31, 2020
  33. Jonathan TanApr 10, 2020
  34. Elijah NewrenApr 11, 2020
  35. Jonathan TanApr 11, 2020
  36. Elijah NewrenApr 11, 2020

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.