Enhance special filename sorting

Previously, filenames were directly locale compared, which caused some
instances of sorting to occur incorrectly (e.g. sorting task.go after
task_test.go). The new behavior is to compare the filenames first, and
then compare the filename with extension iff the filenames are equal.

Bug: Issue 4545
Change-Id: I9fe5a5b111c8ae9b4dc587b97753aa6aa11224ef
This commit is contained in:
Kasper Nilsson
2016-09-12 14:53:33 -07:00
parent 3a3ea11b95
commit 96035d255b
3 changed files with 13 additions and 3 deletions

View File

@@ -139,8 +139,8 @@
} else {
target.blur();
}
// @see Issue 4255.
if (this._inputVal) {
// @see Issue 4255.
page.show('/q/' +
encodeURIComponent(encodeURIComponent(this._inputVal)));
}

View File

@@ -442,8 +442,7 @@
return 1;
}
}
return a.localeCompare(b);
return aFile.localeCompare(bFile) || a.localeCompare(b);
},
getChangeRevisionActions: function(changeNum, patchNum) {

View File

@@ -252,6 +252,17 @@ limitations under the License.
'minidump/minidump_thread_writer.h',
'minidump/minidump_thread_writer.cc',
]);
// Regression test for Issue 4545.
assert.deepEqual([
'task_test.go',
'task.go',
]
.sort(element._specialFilePathCompare),
[
'task.go',
'task_test.go',
]);
});
test('rebase always enabled', function(done) {