Re: [PATCH v2 2/2] dir: find common prefix among non-exclude pathspec items
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 5, 2026, 16:14 UTC
- Message-ID
- <xmqqse3n65gl.fsf@gitster.g>
- In-Reply-To
- <CABPp-BHviE8uLgh6PE=6MYkz_zTDZfKU9CbHQjJOeLgA=qpUSA@mail.gmail.com>
Elijah Newren <newren@gmail.com> writes:
> Maybe I'm misreading the code. Did it always grab the first two bytes > of the element at the beginning of pathspec, or did it get an empty > string? By my reading of the code (copied here for convenience), it > got an empty string:
No, I was the one who misread the code. Indeed in the loop, we assume all elements in the pathspec share the same prefix we have found to be valid so far (the loop is about shortening what we found so far with later elements in the pathspec), and blindly use the first element, which is wrong.