From: Elijah Newren <newren@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Taylor Blau <me@ttaylorr.com>,
Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org, Dmitry Goncharov <dgoncharov@users.sf.net>
Subject: Re: [PATCH 2/2] merge-ort: fix slightly overzealous assertion for rename-to-self
Date: Wed, 12 Mar 2025 23:22:56 -0700 [thread overview]
Message-ID: <CABPp-BF7iTvqKFvuOZ5wZ3vZADjCvB63iKR-4D5+WeTxnZGThg@mail.gmail.com> (raw)
In-Reply-To: <xmqqr031x2gg.fsf@gitster.g>
On Wed, Mar 12, 2025 at 4:18 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Elijah Newren <newren@gmail.com> writes:
>
> > But it might be worth mentioning that having side-effects in
> > assertions is a huge no-no, and I understand that when folks have to
> > debug one of those (I had to in a separate project years ago which was
> > kind of nasty), that they sometimes jump to the conclusion that
> > assertions are bad.
>
> Yes, assert() invites such mistakes. Why not avoid them when there
> are better alternatives like "if (condition) BUG()"?
I mean, I just gave my reasons above which you snipped out. But if
you feel it is important for folks to move away from assert(), would
you like to see someone create a better alternative to assert, such as
BUG_ON(condition), so that they have reason to want to switch?
next prev parent reply other threads:[~2025-03-13 6:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-06 15:30 [PATCH 0/2] merge-ort: fix a crash in process_renames for a file transitively renamed to itself Elijah Newren via GitGitGadget
2025-03-06 15:30 ` [PATCH 1/2] t6423: add a testcase causing a failed assertion in process_renames Dmitry Goncharov via GitGitGadget
2025-03-06 15:30 ` [PATCH 2/2] merge-ort: fix slightly overzealous assertion for rename-to-self Elijah Newren via GitGitGadget
2025-03-12 22:00 ` Taylor Blau
2025-03-12 22:36 ` Elijah Newren
2025-03-12 23:18 ` Junio C Hamano
2025-03-13 6:22 ` Elijah Newren [this message]
2025-03-13 16:55 ` Junio C Hamano
2025-03-13 17:15 ` Elijah Newren
2025-03-13 18:34 ` Junio C Hamano
2025-03-14 0:24 ` Elijah Newren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CABPp-BF7iTvqKFvuOZ5wZ3vZADjCvB63iKR-4D5+WeTxnZGThg@mail.gmail.com \
--to=newren@gmail.com \
--cc=dgoncharov@users.sf.net \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=me@ttaylorr.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).