Re: [PATCH v2 7/8] t4124: fix test for non-compliant diff(1)
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 23, 2020, 20:50 UTC
- Message-ID
- <xmqq8sjq4wyf.fsf@gitster.c.googlers.com>
- In-Reply-To
- <20200323150449.GC11801@danh.dev>
Danh Doan <congdanhqx@gmail.com> writes:
> A comment in test-lib-functions::test_cmp mentions that > there _is_ a diff out there that doesn't understand "-u".
That came from 82ebb0b6 (add test_cmp function for test scripts, 2008-03-12).
The change history at the end of the page:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/diff.html
suggests that POSIX did not require "diff -u" until Issue 7, so it is not surprising that the lack of "diff -u" to cause test_cmp to fail was of real concern back in March 2008, as the application of the errata have been only an year and half old, according to:
https://www.opengroup.org/austin/docs/austin_325.txt
I vaguely recall that some open source projects only took the copied context diffs and not unified ones the last time I checked, but admittedly (1) that "last time" was a long time ago and (2) our popularity and the fact that we do not understand copied context [*1*] may have forced people to move away from "-c" and adopt "-u" at the same time.
So it might be OK to write off any system that does not understand "diff -u" as an unusable trash these days ;-)
IOW, I think I am fine with assuming "diff -u" is available, like Dscho's patch does.
Thanks.
[Footnote]
*1* It used to be my desire to teach "git apply" and "git diff" to
also work with copied context format, but procrastination made
it less and less relevant X-<.