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

Re: [PATCH v2] sequencer: fix edit handling for cherry-pick and revert messages

From
Elijah Newren <newren@gmail.com>
Date
Apr 1, 2021, 16:31 UTC
Message-ID
<CABPp-BFLyYTboiGkP=sc7S+stRZvozAqnJPnza+M0q2nakvD2Q@mail.gmail.com>
In-Reply-To
<xmqqmtuj8ank.fsf@gitster.g>
On Wed, Mar 31, 2021 at 11:01 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 17 quoted lines
>
> Elijah Newren <newren@gmail.com> writes:
>
> > ... would you two prefer
> > that I add a new affirm() function that is ALSO compiled out in
> > production?
>
> The reason I do not think affirm would fly is because it shares the
> most problematic trait with assert(): it can be comipled out.
>
> There was at least one bug we found and fixed in a piece of code
> that came later in a codepath that had an assert() in it.  The buggy
> code (IIRC, it was added way after the assert() was written in an
> unrelated patch) was unknowingly depending on a side-effect of an
> innocuous function call (i.e. assert(func_tion(args) == expected))
> made in the assert condition, and the bug did not reproduce in the
> developer's environment.

Ah, now that's a much different argument than claiming assert is useless. I had to debug one of those once about a decade ago, in a different project, put in by some other developer, and yeah it's painful.

If that causes assert() to be frowned upon, then I can understand based on this reason. If so, perhaps a BUG_ON() function would be useful? The "if (...) BUG()" construct causes line coverage problems and I find it an onerous way to signal to future code readers "hey, just as a reminder, these things should be true at this point". If you need to signal something more than that or explain why the things being false is a problem or what might cause it, then the "if (...) BUG()" construct is useful and there are certainly many places for that, but it just doesn't fit all the cases.

Previous: Junio C HamanoNext: Elijah Newren
Message 15 of 28 in “sequencer: fix edit handling for cherry-pick and revert messages”
  1. sequencer: fix edit handling for cherry-pick and revert messagesElijah Newren via GitGitGadget, Mar 26, 2021
  2. Philip OakleyMar 26, 2021
  3. Elijah NewrenMar 26, 2021
  4. Junio C HamanoMar 28, 2021
  5. Phillip WoodMar 29, 2021
  6. Junio C HamanoMar 29, 2021
  7. Elijah NewrenMar 29, 2021
  8. sequencer: fix edit handling for cherry-pick and revert messagesElijah Newren via GitGitGadget, Mar 30, 2021
  9. Johannes SchindelinMar 30, 2021
  10. Junio C HamanoMar 30, 2021
  11. Elijah NewrenMar 30, 2021
  12. Ævar Arnfjörð BjarmasonMar 31, 2021
  13. Elijah NewrenMar 31, 2021
  14. Junio C HamanoMar 31, 2021
  15. Elijah NewrenApr 1, 2021
  16. Elijah NewrenMar 30, 2021
  17. unifying sequencer's options persisting, was Re: [PATCH v2] sequencer: fix edit handling for cherry-pick and revert messagesJohannes Schindelin, Mar 31, 2021
  18. Phillip WoodApr 2, 2021
  19. Phillip WoodApr 2, 2021
  20. Junio C HamanoApr 2, 2021
  21. Elijah NewrenApr 2, 2021
  22. Junio C HamanoApr 2, 2021
  23. Johannes SchindelinApr 8, 2021
  24. Junio C HamanoApr 8, 2021
  25. Christian CouderApr 8, 2021
  26. Johannes SchindelinApr 9, 2021
  27. sequencer: fix edit handling for cherry-pick and revert messagesElijah Newren via GitGitGadget, Mar 31, 2021
  28. Johannes SchindelinMar 31, 2021

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.