##// END OF EJS Templates
rhg: fix a bug in path encoding, demonstrated in the parent commit
Arseniy Alekseyev -
r51263:0b84474e stable
parent child Browse files
Show More
@@ -546,7 +546,13 b' fn hash_mangle(src: &[u8], sha: &[u8]) -'
546 546 if dest.len() + slice.len() > maxshortdirslen + 3 {
547 547 break;
548 548 } else {
549 dest.write_bytes(slice);
549 let last_char = slice[slice.len() - 1];
550 if last_char == b'.' || last_char == b' ' {
551 dest.write_bytes(&slice[0..slice.len() - 1]);
552 dest.write_byte(b'_');
553 } else {
554 dest.write_bytes(slice);
555 }
550 556 }
551 557 dest.write_byte(b'/');
552 558 }
@@ -612,8 +618,7 b' mod tests {'
612 618 #[test]
613 619 fn test_dirname_ends_with_underscore() {
614 620 let input = b"data/dir1234.foo/ABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJ.i";
615 // TODO: BUG: trailing dot should become an underscore
616 let expected = b"dh/dir1234./abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij.if2e9ce59e095eff5f8f334dc809e65606a0aa50b.i";
621 let expected = b"dh/dir1234_/abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij.if2e9ce59e095eff5f8f334dc809e65606a0aa50b.i";
617 622 let res = path_encode(input);
618 623 assert_eq!(
619 624 HgPathBuf::from_bytes(&res),
General Comments 0
You need to be logged in to leave comments. Login now