Patchwork D8211: rust-pathauditor: actually split Windows shortname aliases at `~`

login
register
mail settings
Submitter phabricator
Date March 4, 2020, 2:45 p.m.
Message ID <differential-rev-PHID-DREV-nblghvf3f6pmuzn7jji3-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45451/
State Superseded
Headers show

Comments

phabricator - March 4, 2020, 2:45 p.m.
Alphare created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Right now, splitting with a max of 1 parts is useless.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8211

AFFECTED FILES
  rust/hg-core/src/utils/path_auditor.rs

CHANGE DETAILS




To: Alphare, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/rust/hg-core/src/utils/path_auditor.rs b/rust/hg-core/src/utils/path_auditor.rs
--- a/rust/hg-core/src/utils/path_auditor.rs
+++ b/rust/hg-core/src/utils/path_auditor.rs
@@ -67,7 +67,7 @@ 
         // Windows shortname aliases
         for part in parts.iter() {
             if part.contains(&b'~') {
-                let mut split = part.splitn(1, |b| *b == b'~');
+                let mut split = part.splitn(2, |b| *b == b'~');
                 let first =
                     split.next().unwrap().to_owned().to_ascii_uppercase();
                 let last = split.next().unwrap();