Re: [PATCH 17/18] revert: Introduce --continue to continue the operation
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 3, 2011, 17:30 UTC
- Message-ID
- <7v4o1ycsi4.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <CALkWK0mrx+3jdCQD9xya3AWMsPpSiZzEz+Z9XVxZNzw3UdKMVw@mail.gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
Show 6 quoted lines
>>> + for (p = buf.buf; *p; p = strchr(p, '\n') + 1) {
>>
>> This relies on a "\n" at the end of the last line...
>
> Yes, that was intentional. Every editor I know of inserts a '\n' at
> the end of the last line,...Why do you think "diff" has a special codepath to report "No newline at end of file"? Because some editors do leave an incomplete line incomplete.
When working on a "buf" with an incomplete line at the end, the last round of the loop will assign "(char *) 1" to "p", try to see "*p" is NUL and segfault, no?