extract_utils: Stop treating subdirs as special during sort
A proper directory listing doesn't put subdirs first, nor do we put subdirs up front when generating the resultant makefiles, so there is no good reason to shove them to the top when sorting a blob list. Change-Id: I381f95d0bcf1ddf7827453abdfbde14e5faab4e1
This commit is contained in:
@@ -21,26 +21,6 @@ def strcoll_extract_utils(string1: str, string2: str) -> int:
|
||||
string1 = re.sub("^-", "", string1)
|
||||
string2 = re.sub("^-", "", string2)
|
||||
|
||||
# If no directories, compare normally
|
||||
if "/" not in string1 and "/" not in string2:
|
||||
return strcoll(string1, string2)
|
||||
|
||||
string1_dir = string1.rsplit("/", 1)[0] + "/"
|
||||
string2_dir = string2.rsplit("/", 1)[0] + "/"
|
||||
if string1_dir == string2_dir:
|
||||
# Same directory, compare normally
|
||||
return strcoll(string1, string2)
|
||||
|
||||
if string1_dir.startswith(string2_dir):
|
||||
# First string dir is a subdirectory of the second one,
|
||||
# return string1 > string2
|
||||
return -1
|
||||
|
||||
if string2_dir.startswith(string1_dir):
|
||||
# Second string dir is a subdirectory of the first one,
|
||||
# return string2 > string1
|
||||
return 1
|
||||
|
||||
# Compare normally
|
||||
return strcoll(string1, string2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user