Mercurial > public > mercurial-scm > hg
diff rust/hg-core/src/repo.rs @ 47949:696abab107b4
rust: Generalize the `trim_end_newlines` utility of byte strings
? into `trim_end_matches` that takes a callack.
Also add `trim_start_matches`.
Differential Revision: https://phab.mercurial-scm.org/D11388
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Fri, 03 Sep 2021 16:37:20 +0200 |
parents | cf5f8da2244c |
children | 9cd35c8c6044 |
line wrap: on
line diff
--- a/rust/hg-core/src/repo.rs Mon Aug 30 21:18:29 2021 +0200 +++ b/rust/hg-core/src/repo.rs Fri Sep 03 16:37:20 2021 +0200 @@ -127,7 +127,8 @@ } else { let bytes = hg_vfs.read("sharedpath")?; let mut shared_path = - get_path_from_bytes(bytes.trim_end_newlines()).to_owned(); + get_path_from_bytes(bytes.trim_end_matches(|b| b == b'\n')) + .to_owned(); if relative { shared_path = dot_hg.join(shared_path) }