Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:41:58

quoted
quoted
quoted
quoted
"LT" == Linus Torvalds [off-list ref] writes:
LT> On Tue, 24 May 2005, Junio C Hamano wrote:
quoted
LT> Also, what language do you actually speak?
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help