##// END OF EJS Templates
rhg: correctly relativize copy source path
Arun Kulshreshtha -
r51338:51041a1a stable
parent child Browse files
Show More
@@ -542,12 +542,17 b" impl DisplayStatusPaths<'_> {"
542 542 // TODO: get the stdout lock once for the whole loop
543 543 // instead of in each write
544 544 for StatusPath { path, copy_source } in paths {
545 let relative;
546 let path = if let Some(relativize) = &self.relativize {
547 relative = relativize.relativize(&path);
548 &*relative
545 let relative_path;
546 let relative_source;
547 let (path, copy_source) = if let Some(relativize) =
548 &self.relativize
549 {
550 relative_path = relativize.relativize(&path);
551 relative_source =
552 copy_source.as_ref().map(|s| relativize.relativize(s));
553 (&*relative_path, relative_source.as_deref())
549 554 } else {
550 path.as_bytes()
555 (path.as_bytes(), copy_source.as_ref().map(|s| s.as_bytes()))
551 556 };
552 557 // TODO: Add a way to use `write_bytes!` instead of `format_bytes!`
553 558 // in order to stream to stdout instead of allocating an
@@ -560,7 +565,7 b" impl DisplayStatusPaths<'_> {"
560 565 if let Some(source) = copy_source.filter(|_| !self.no_status) {
561 566 let label = "status.copied";
562 567 self.ui.write_stdout_labelled(
563 &format_bytes!(b" {}\n", source.as_bytes()),
568 &format_bytes!(b" {}\n", source),
564 569 label,
565 570 )?
566 571 }
General Comments 0
You need to be logged in to leave comments. Login now