[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Sorting Bug

From: B. Smith-Mannschott <benpsm_at_gmail.com>
Date: Thu, 24 Jan 2008 19:18:35 +0100

        
On Jan 24, 2008, at 16:26, Matthew Bluhm wrote:

>
> My list of subfolders is not sorted correctly
>
> It show a list of my subfolders as :
> 4.907
> 4.908
> 4.9100
> 4.9102
> 4.90801 <-- this one should be between 4.908 and 4.9100

This behavior has nothing to do with TortoiseSVN. That's just the way
Vista sorts file names in its graphical file browser. In the olden
days file names were sorted by comparing them character-by-character
as you might sort words in a dictionary.

This is perfectly logical behavior to computer programmers, but seems
to have confused and annoyed some of the non-programming set because
the computer would sort things "wrong":

1
10
2
3
4
5
6
7
8
9

So. The Microsofties (and Appleheads) got the idea to fix this. They
split each file name up into alternating numeric and non-numeric
chunks and then compare the chunks one at a time. The trick here, is
that they compare the numeric parts as numbers, so now the list above,
where each file name consists of just a single numeric "chunk" sorts
like this:

1
2
3
4
5
6
7
8
9
10

So, when Vista sees your file names, it's seeing each of them as three
chunks:

4 . 907
4 . 908
4 . 9100
4 . 9102
4 . 90801

And since 90801 is clearly greater than 9102, the last file name gets
sorted to the end.

// ben

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_tortoisesvn.tigris.org
For additional commands, e-mail: users-help_at_tortoisesvn.tigris.org
Received on 2008-01-24 19:19:08 CET

This is an archived mail posted to the TortoiseSVN Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.