Subject: Re: [PATCH] t4013: add expected failure for "log --patch --no-patch"

From: Sergey Organov <[email-masked]>
Date: Thu, 04 May 2023 21:24:05 +0300

Junio C Hamano <[email-masked]> writes:

> Junio C Hamano <[email-masked]> writes:
>
>> Sergey Organov <[email-masked]> writes:
>>
>>> No problem from my side, but are you sure?
>>
>> Absolutely.
>>
>> I've seen people just say "we document a failed one" and leave it at
>> that, without attempting to fix.  I am trying to see if pushing back
>> at first would serve as a good way to encourage these known failure
>> to be fixed, without accumulating too many expect_failure in our
>> test suite, which will waste cycles at CI runs (which do not need to
>> be reminded something is known to be broken).  I will try not to do
>> this when I do not positively know the author of such a patch is
>> capable enough to provide a fix, though, and you are unlucky enough
>> to have shown your abilities in the past ;-)
>
> I ended up spending some time digging history and remembered that
> "--no-patch" was added as a synonym to "-s" by d09cd15d (diff: allow
> --no-patch as synonym for -s, 2013-07-16).  These
>
>     git diff -p --stat --no-patch HEAD^ HEAD
>     git diff -p --raw --no-patch HEAD^ HEAD
>
> would show no output from the diff machinery, patches, diffstats,
> raw object names, etc.

[-s meaning "silent" at that time? If so, making --no-patch a synonym for
"silent", and then documenting -s a synonym for --no-patch sounds like
quite a twitch.]

Anyway, this seems pretty irrelevant to the test case. Even
if we spell --no-patch as -s,

 git diff -s --raw HEAD^ HEAD

should produce what? To me it should be the same as

 git diff --raw HEAD^ HEAD

as -s turns off everything, and then --raw is turned on. In reality this
is not the case though, and that's what the test case is about.

Notice that

 git diff -s --patch

does produce the patch output, whereas

 git diff -s --raw
 git diff -s --stat

produce none. Sounds like nonsense.

> And this turns out to be a prime example why the approach to ask
> contributors do more, would help the project overall. What I should
> have done, instead of asking for the test with its expect_failure
> turned into expect_success *and* a fix to the code to make the new
> test work, was to ask to see if it is really a bug in the behaviour or
> if the documentation is wrong. Then your reaction wouldn't have been
> "are you sure?". It hopefully would have been "ah, the intent is not
> documented correctly, and here is a documentation patch to fix it.

Yep, documentation then needs to be fixed as well to match the
intention, but this is unrelated to the test-case, see above.

> When a command does not behave the way one thinks it should, being
> curious is good.  Reporting it as a potential bug is also good.  But
> it would help the project more if it was triaged before reporting it
> as a potential bug, if the reporter is capable of doing so.  Those
> who encounter behaviour unexpected to them are more numerous than
> those who can report it as a potential bug (many people are not
> equipped to write a good bug report), and those who can triage and
> diagnose a bug report are fewer.  Those who can come up with a
> solution is even more scarse.

I'm afraid the solution I'd come up with won't be welcomed. If I'd start
to "fix" it, it'd be likely set of independent options:

 --patch --no-patch
 --raw   --no-raw
 --stat  --no-stat

and then

 -s being just a shortcut for "--no-raw --no-patch --no-stat"

Easy to understand, simple to implement, straightforward to document,
all intentions are perfectly obvious. But then these are to be new
options to keep backward compatibility, and... No, thanks.

Overall, as I neither able to make sense of the current set of
intentions, nor even figure out what they are in the first place, I'm
not the right person to fix implementation of these intentions, or even
figure out for sure if a fix is needed.

Thanks,
-- Sergey Organov