We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 28c056c commit ea169a6Copy full SHA for ea169a6
git-object/src/tree/mod.rs
@@ -90,8 +90,10 @@ impl PartialOrd for Entry {
90
impl Ord for Entry {
91
/// Entries compare by the common portion of the filename. This is critical for proper functioning of algorithms working on trees.
92
fn cmp(&self, other: &Self) -> Ordering {
93
- let len = self.filename.len().min(other.filename.len());
94
- self.filename[..len].cmp(&other.filename[..len])
+ let common_len = self.filename.len().min(other.filename.len());
+ self.filename[..common_len]
95
+ .cmp(&other.filename[..common_len])
96
+ .then_with(|| self.filename.len().cmp(&other.filename.len()))
97
}
98
99
0 commit comments