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.cThis 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.