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

Re: [PATCH v3 5/7] builtin: patch-id: add --include-whitespace as a command mode

From
Jerry Zhang <jerry@skydio.com>
Date
Oct 14, 2022, 22:55 UTC
Message-ID
<CAMKO5CuCbyFt739GOzcvFn92i8vNqK6vgJqvT8E5zs=kJ1+H=A@mail.gmail.com>
In-Reply-To
<xmqqbkqe6qv4.fsf@gitster.g>
On Fri, Oct 14, 2022 at 2:24 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 13 quoted lines
>
> "Jerry Zhang via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > +--include-whitespace::
> > +     Use the "stable" algorithm described below and also don't strip whitespace
> > +     from lines when calculating the patch-id.
> > +
> > +     This is the default if patchid.includeWhitespace is true and implies
> > +     patchid.stable.
>
> This seems very much orthogonal to "--stable/--unstable.
>
> Because the "--stable" variant is more expensive than "--unstable",

I didn't realize it was more expensive, I'm assuming you mean in terms of time, maybe it does slightly more hashing operations under the hood? I tried timing some runs locally and they were a wash:

time /bin/sh -c "git show | git patch-id --stable" dddea79ee68d62a32cf8c0d7bb6691bcd0445628 4677fe858366a51ff3c5a0c0893418e32e934262

real 0m0.011s user 0m0.003s sys 0m0.012s time /bin/sh -c "git show | git patch-id" 6602a3b2fe8b17d5bc295c2703901ad3e18eee18 4677fe858366a51ff3c5a0c0893418e32e934262

real 0m0.012s user 0m0.009s sys 0m0.007s

The operation is probably bound by process / disk overhead quite a bit and a small amount of cpu use wouldn't really be user-visible. Based on these results I don't think a user would choose --unstable just for the speed gain (if any).

Show 7 quoted lines
> I am not sure why such an implication is a good thing to have.  Why
> can we not have
>
>     --include-whitespace --stable
>     --include-whitespace --unstable
>
> both combinations valid?

If you accept my point above, then a user would only choose "--unstable" if they actually had a need for backwards compatibility, such as for a persistent database. Trying to include whitespace on top of that would break the compatibility they're relying on. So my conclusion was that there isn't any usecase for the combination "--include-whitespace --unstable", and it's better for usability and not needing to always maintain compatibility if we don't expose it to users at all.

Previous: Junio C HamanoNext: Junio C Hamano
Message 26 of 46 in “update internal patch-id to use "stable" algorithm”
  1. 0/2 update internal patch-id to use "stable" algorithmJerry Zhang via GitGitGadget, Sep 20, 2022
  2. 2/2 patch-id: use stable patch-id for rebasesJerry Zhang via GitGitGadget, Sep 20, 2022
  3. 1/2 patch-id: fix stable patch id for binary / header-onlyJerry Zhang via GitGitGadget, Sep 20, 2022
  4. 0/2 update internal patch-id to use "stable" algorithmJerry Zhang via GitGitGadget, Sep 20, 2022
  5. 1/2 patch-id: fix stable patch id for binary / header-onlyJerry Zhang via GitGitGadget, Sep 20, 2022
  6. 2/2 patch-id: use stable patch-id for rebasesJerry Zhang via GitGitGadget, Sep 20, 2022
  7. 0/7 patch-id fixes and improvementsJerry Zhang via GitGitGadget, Oct 14, 2022
  8. 1/7 patch-id: fix stable patch id for binary / header-onlyJerry Zhang via GitGitGadget, Oct 14, 2022
  9. 2/7 patch-id: use stable patch-id for rebasesJerry Zhang via GitGitGadget, Oct 14, 2022
  10. 3/7 builtin: patch-id: fix patch-id with binary diffsJerry Zhang via GitGitGadget, Oct 14, 2022
  11. Junio C HamanoOct 14, 2022
  12. Jerry ZhangOct 14, 2022
  13. Junio C HamanoOct 14, 2022
  14. Jerry ZhangOct 14, 2022
  15. Junio C HamanoOct 17, 2022
  16. 7/7 documentation: format-patch: clarify requirements for patch-ids to matchJerry Zhang via GitGitGadget, Oct 14, 2022
  17. Junio C HamanoOct 17, 2022
  18. Jerry ZhangOct 18, 2022
  19. Junio C HamanoOct 19, 2022
  20. 4/7 patch-id: fix patch-id for mode changesJerry Zhang via GitGitGadget, Oct 14, 2022
  21. Junio C HamanoOct 14, 2022
  22. 6/7 builtin: patch-id: remove unused diff-tree prefixJerry Zhang via GitGitGadget, Oct 14, 2022
  23. Junio C HamanoOct 14, 2022
  24. 5/7 builtin: patch-id: add --include-whitespace as a command modeJerry Zhang via GitGitGadget, Oct 14, 2022
  25. Junio C HamanoOct 14, 2022
  26. Jerry ZhangOct 14, 2022
  27. Junio C HamanoOct 17, 2022
  28. Jerry ZhangOct 18, 2022
  29. 0/6 patch-id fixes and improvementsJerry Zhang via GitGitGadget, Oct 20, 2022
  30. 1/6 patch-id: fix stable patch id for binary / header-onlyJerry Zhang via GitGitGadget, Oct 20, 2022
  31. 2/6 patch-id: use stable patch-id for rebasesJerry Zhang via GitGitGadget, Oct 20, 2022
  32. 3/6 builtin: patch-id: fix patch-id with binary diffsJerry Zhang via GitGitGadget, Oct 20, 2022
  33. 4/6 patch-id: fix patch-id for mode changesJerry Zhang via GitGitGadget, Oct 20, 2022
  34. 5/6 builtin: patch-id: add --verbatim as a command modeJerry Zhang via GitGitGadget, Oct 20, 2022
  35. 6/6 builtin: patch-id: remove unused diff-tree prefixJerry Zhang via GitGitGadget, Oct 20, 2022
  36. Junio C HamanoOct 21, 2022
  37. 0/6 patch-id fixes and improvementsJerry Zhang via GitGitGadget, Oct 24, 2022
  38. 4/6 patch-id: fix patch-id for mode changesJerry Zhang via GitGitGadget, Oct 24, 2022
  39. 5/6 builtin: patch-id: add --verbatim as a command modeJerry Zhang via GitGitGadget, Oct 24, 2022
  40. 1/6 patch-id: fix stable patch id for binary / header-onlyJerry Zhang via GitGitGadget, Oct 24, 2022
  41. 2/6 patch-id: use stable patch-id for rebasesJerry Zhang via GitGitGadget, Oct 24, 2022
  42. 3/6 builtin: patch-id: fix patch-id with binary diffsJerry Zhang via GitGitGadget, Oct 24, 2022
  43. 6/6 builtin: patch-id: remove unused diff-tree prefixJerry Zhang via GitGitGadget, Oct 24, 2022
  44. Junio C HamanoOct 24, 2022
  45. Junio C HamanoSep 21, 2022
  46. Jerry ZhangSep 21, 2022

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.