changeset 41725:ffbf742bfe1f stable

subrepo: add test for Windows relative-ish path with drive letter Matt Harbison pointed out that Windows had some weird path syntax. Fortunately it's rejected appropriately by pathauditor, so we're safe. Let's test the behavior as we have a special handling for Windows drive letters. This patch includes a basic example. Maybe we'll need to extend the test case further, but writing such tests on Linux isn't easy.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 07 Feb 2019 20:50:41 +0900
parents f2f538725d07
children a62690659d6b 3d5a73c8a417
files tests/test-audit-subrepo.t
diffstat 1 files changed, 41 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-audit-subrepo.t	Thu Feb 07 11:08:54 2019 +0100
+++ b/tests/test-audit-subrepo.t	Thu Feb 07 20:50:41 2019 +0900
@@ -660,3 +660,44 @@
   $ cd ..
 
 #endif
+
+Test drive letter
+-----------------
+
+Windows has a weird relative path that can change the drive letter, which
+should also be prohibited on Windows.
+
+prepare tampered repo:
+
+  $ hg init driveletter
+  $ cd driveletter
+  $ hg import --bypass -qm 'add subrepo "X:"' - <<'EOF'
+  > diff --git a/.hgsub b/.hgsub
+  > new file mode 100644
+  > --- /dev/null
+  > +++ b/.hgsub
+  > @@ -0,0 +1,1 @@
+  > +X: = foo
+  > diff --git a/.hgsubstate b/.hgsubstate
+  > new file mode 100644
+  > --- /dev/null
+  > +++ b/.hgsubstate
+  > @@ -0,0 +1,1 @@
+  > +0000000000000000000000000000000000000000 X:
+  > EOF
+  $ cd ..
+
+on clone (and update):
+
+#if windows
+
+  $ hg clone -q driveletter driveletter2
+  abort: path contains illegal component: X:
+
+#else
+
+  $ hg clone -q driveletter driveletter2
+  $ ls driveletter2
+  X:
+
+#endif