Re: [PATCH] show-branch: fix SEGFAULT on both --current & --reflog
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 22, 2022, 18:43 UTC
- Message-ID
- <xmqq4k2l9cwo.fsf@gitster.g>
- In-Reply-To
- <xmqqv8v19ght.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 7 quoted lines
>> It seems that it has been introduced in: Commit 1aa68d6735 >> (show-branch: --current includes the current branch., 2006-01-11) > > Yes, the commit should have noticed the invalid combination of > options were given and errored out. Since omission of such a check > lead to a segfaulting bug without producing any useful output, it > is safe to make it an error to give these options at the same time.
Actually, no, the commit couldn't have been the culprit. Back when 1aa58d6735 was written, "--reflog" option did not even exist.
If we want to find a commit to blame, it is 76a44c5c (show-branch --reflog: show the reflog message at the top., 2007-01-19). That commit should have caught invalid combination. It did attempt to catch some invalid combinations (like --more in the reflog mode), but apparently forgot to notice that --current does not make sense to be used in the new mode it was adding.
Thanks.