git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] diff-cache path restriction fix.

From
Junio C Hamano <junkio@cox.net>
Date
May 25, 2005, 03:22 UTC
Message-ID
<7vwtpong4s.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.58.0505242002340.2307@ppc970.osdl.org>
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
LT> On Tue, 24 May 2005, Junio C Hamano wrote:
>> 
LT> Also, what language do you actually speak?
>> 
>> Japanese.

LT> It is possible it is cultural. I certainly find it harder to read the LT> "unexpected" way.

I doubt it is Japanese vs Western kind of cultural. When I said "people around me", that set of people did not include a single Japanese. I meant people who worked with the person I was trained by to use this style. Cultural, maybe, but that is programming culture and definitely not natural language culture in my case.

Here is a quick and dirty experiment which showed quite an interesting statistics. It counts number of '<' and '>' in the program text, after stripping out ptr->deref (yes it catches #include <stdlib.h>, but they even out and it also catches whatever is in comments, but this is just a Q&D stats for fun). The percentage is how close the program text is to "visually ordered" style:

    $ cat count-compare.perl
    #!/usr/bin/perl -w 
    for my $filename (@ARGV) {
        open I, '<', $filename;
        my ($lt, $gt) = (0, 0);
        while (<I>) {
            s/->//g; # pointer deref not comparison
            $lt += tr/</</; # count
            $gt += tr/>/>/; # count
        }
        close I;
        my $ratio = ($lt / ($lt + $gt)) * 100;
        printf "'<' (%d) '>' (%d) (%d%%) %s\n", $lt, $gt, $ratio, $filename;
    }
    $ perl count-compare.perl diff*.c
    '<' (9) '>' (4) (69%) diff-cache.c
    '<' (20) '>' (26) (43%) diff-delta.c
    '<' (8) '>' (1) (88%) diff-files.c
    '<' (12) '>' (1) (92%) diff-helper.c
    '<' (11) '>' (11) (50%) diff-tree.c
    '<' (28) '>' (10) (73%) diff.c
    '<' (3) '>' (0) (100%) diffcore-pathspec.c
    '<' (2) '>' (0) (100%) diffcore-pickaxe.c
    '<' (22) '>' (6) (78%) diffcore-rename.c

This clearly shows that diff-delta.c does not have my code at all. Most of the others have been touched moderately to heavily by me, or in some cases done entirely by me.

Personally, what I find most interesting is that diff-tree.c is something you did quite a lot of nice features (and hence something I was afraid to touch), and the number clearly shows my hesitation. It does not have as many '<' as it would have had, if I had mucked with it as freely as I did to the others.

Previous: Linus TorvaldsNext: Ingo Molnar
Message 9 of 17 in “diff-cache path restriction fix.”
  1. diff-cache path restriction fix.Junio C Hamano, May 25, 2005
  2. Linus TorvaldsMay 25, 2005
  3. Junio C HamanoMay 25, 2005
  4. Linus TorvaldsMay 25, 2005
  5. Junio C HamanoMay 25, 2005
  6. Russ AllberyMay 25, 2005
  7. Junio C HamanoMay 25, 2005
  8. Linus TorvaldsMay 25, 2005
  9. Junio C HamanoMay 25, 2005
  10. Ingo MolnarMay 25, 2005
  11. Linus TorvaldsMay 25, 2005
  12. Junio C HamanoMay 25, 2005
  13. Thomas GlanzmannMay 25, 2005
  14. Matthias UrlichsMay 25, 2005
  15. [OT] if (4 < number_of_children) you're in troubleJunio C Hamano, May 28, 2005
  16. Ingo MolnarMay 25, 2005
  17. Florian WeimerMay 25, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.