comparison tests/test-audit-subrepo.t @ 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 83377b4b4ae0
children a62690659d6b
comparison
equal deleted inserted replaced
41614:f2f538725d07 41725:ffbf742bfe1f
658 a 658 a
659 659
660 $ cd .. 660 $ cd ..
661 661
662 #endif 662 #endif
663
664 Test drive letter
665 -----------------
666
667 Windows has a weird relative path that can change the drive letter, which
668 should also be prohibited on Windows.
669
670 prepare tampered repo:
671
672 $ hg init driveletter
673 $ cd driveletter
674 $ hg import --bypass -qm 'add subrepo "X:"' - <<'EOF'
675 > diff --git a/.hgsub b/.hgsub
676 > new file mode 100644
677 > --- /dev/null
678 > +++ b/.hgsub
679 > @@ -0,0 +1,1 @@
680 > +X: = foo
681 > diff --git a/.hgsubstate b/.hgsubstate
682 > new file mode 100644
683 > --- /dev/null
684 > +++ b/.hgsubstate
685 > @@ -0,0 +1,1 @@
686 > +0000000000000000000000000000000000000000 X:
687 > EOF
688 $ cd ..
689
690 on clone (and update):
691
692 #if windows
693
694 $ hg clone -q driveletter driveletter2
695 abort: path contains illegal component: X:
696
697 #else
698
699 $ hg clone -q driveletter driveletter2
700 $ ls driveletter2
701 X:
702
703 #endif