comparison rust/hg-core/src/revlog/path_encode.rs @ 50165:4180c988d1d5

rhg: small refactor: stop using a magical constant "+ 1" Instead, directly do what the "+ 1" was supposed to achive: call hash_encode.
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Thu, 16 Feb 2023 19:14:51 +0000
parents 8e50aa0db347
children 6ea3b1acb5de
comparison
equal deleted inserted replaced
50164:8e50aa0db347 50165:4180c988d1d5
598 let newlen = if path.len() <= MAXSTOREPATHLEN { 598 let newlen = if path.len() <= MAXSTOREPATHLEN {
599 let mut measure = MeasureDest::create(); 599 let mut measure = MeasureDest::create();
600 basic_encode(&mut measure, path); 600 basic_encode(&mut measure, path);
601 measure.len 601 measure.len
602 } else { 602 } else {
603 MAXSTOREPATHLEN + 1 603 return hash_encode(path);
604 }; 604 };
605 if newlen <= MAXSTOREPATHLEN { 605 if newlen <= MAXSTOREPATHLEN {
606 if newlen == path.len() { 606 if newlen == path.len() {
607 path.to_vec() 607 path.to_vec()
608 } else { 608 } else {