Subject: Re: [PATCH v14 03/10] refs: standardize output of refs_read_symbolic_ref

From: Junio C Hamano <[email-masked]>
Date: Mon, 25 Nov 2024 11:56:39 +0900

"Bence Ferdinandy" <[email-masked]> writes:

>> At the least you should see `git log`'s output, but if there are issues
>> they should be shown inline. So when you say 'no output' do you mean you
>> see absolutely no output?
>
> Absolutely no output:
> 	https://asciinema.org/a/lsqp4e1bNst6cFWw9M2jX1IqC
>
> But I figured out why: the whitespace and the tabs were not mixed on the line,
> just across lines. As I read it, that is not an error to have tabs on one line
> and spaces on the next.

Our .gitattribute starts like so:

    * whitespace=!indent,trail,space
    *.[ch] whitespace=indent,trail,space diff=cpp

so, unless otherwise specified, we frown upon trailing whitespace
and space before tab and indenting with non tab is permitted, but C
source and header files have further care about "indent" (short for
"indent-with-non-tab".

So mixed or not, if you indented with spaces and not tabs, that
would be noticed.

> Anyhow that should be now cleared up, thanks. Gotta say, I was expecting to
> learn about internals doing this, but I also ended up picking up a couple of
> usage things as well, like --range-diff for format patch and such.

I usually have "--whitespace=fix" so if you did "git log" on the
commits I made out of your patches, it is not surprising if your
"log --check" was silent.

I re-applied your v14 with "git am -s --whitespace=nowarn" and here
is what I saw.

commit 75a6a3e6597d5f3959eb269122e8c5f4e4baac0e
Author: Bence Ferdinandy <[email-masked]>
Date:   Thu Nov 21 23:55:03 2024 +0100

    refs: standardize output of refs_read_symbolic_ref
    
    When the symbolic reference we want to read with refs_read_symbolic_ref
    is actually not a symbolic reference, the files and the reftable
    backends return different values (1 and -1 respectively). Standardize
    the returned values so that 0 is success, -1 is a generic error and -2
    is that the reference was actually non-symbolic.
    
    Signed-off-by: Bence Ferdinandy <[email-masked]>
    Signed-off-by: Junio C Hamano <[email-masked]>

refs/reftable-backend.c:833: indent with spaces.
+        if (ret)
refs/reftable-backend.c:834: indent with spaces.
+                ret = -1;
refs/reftable-backend.c:835: indent with spaces.
+        else if (ref.value_type == REFTABLE_REF_SYMREF)
refs/reftable-backend.c:837: indent with spaces.
+        else
refs/reftable-backend.c:838: indent with spaces.
+                ret = NOT_A_SYMREF;