tests/test-audit-subrepo.t
branchstable
changeset 41458 83377b4b4ae0
parent 41457 6c10eba6b9cd
child 41725 ffbf742bfe1f
equal deleted inserted replaced
41457:6c10eba6b9cd 41458:83377b4b4ae0
   277   $ cd ..
   277   $ cd ..
   278 
   278 
   279 on clone (and update) with various substitutions:
   279 on clone (and update) with various substitutions:
   280 
   280 
   281   $ hg clone -q main main2
   281   $ hg clone -q main main2
       
   282   abort: subrepo path contains illegal component: $SUB
       
   283   [255]
   282   $ ls main2
   284   $ ls main2
   283   $SUB
       
   284 
   285 
   285   $ SUB=sub1 hg clone -q main main3
   286   $ SUB=sub1 hg clone -q main main3
   286   abort: subrepo path contains illegal component: $SUB
   287   abort: subrepo path contains illegal component: $SUB
   287   [255]
   288   [255]
   288   $ ls main3
   289   $ ls main3
   361   $ cd ..
   362   $ cd ..
   362 
   363 
   363 Test tilde
   364 Test tilde
   364 ----------
   365 ----------
   365 
   366 
   366 The leading tilde may be expanded to $HOME, but it's a valid subrepo path.
   367 The leading tilde may be expanded to $HOME, but it can be a valid subrepo
   367 However, we might want to prohibit it as it seems potentially unsafe.
   368 path in theory. However, we want to prohibit it as there might be unsafe
       
   369 handling of such paths.
   368 
   370 
   369 on commit:
   371 on commit:
   370 
   372 
   371   $ hg init tilde
   373   $ hg init tilde
   372   $ cd tilde
   374   $ cd tilde
   373   $ hg init './~'
   375   $ hg init './~'
   374   $ echo '~ = ~' >> .hgsub
   376   $ echo '~ = ~' >> .hgsub
   375   $ hg ci -qAm 'add subrepo "~"'
   377   $ hg ci -qAm 'add subrepo "~"'
   376   $ ls
   378   abort: subrepo path contains illegal component: ~
   377   ~
   379   [255]
       
   380 
       
   381 prepare tampered repo (including the commit above):
       
   382 
       
   383   $ hg import --bypass -qm 'add subrepo "~"' - <<'EOF'
       
   384   > diff --git a/.hgsub b/.hgsub
       
   385   > new file mode 100644
       
   386   > --- /dev/null
       
   387   > +++ b/.hgsub
       
   388   > @@ -0,0 +1,1 @@
       
   389   > +~ = ~
       
   390   > diff --git a/.hgsubstate b/.hgsubstate
       
   391   > new file mode 100644
       
   392   > --- /dev/null
       
   393   > +++ b/.hgsubstate
       
   394   > @@ -0,0 +1,1 @@
       
   395   > +0000000000000000000000000000000000000000 ~
       
   396   > EOF
   378   $ cd ..
   397   $ cd ..
   379 
   398 
   380 on clone (and update):
   399 on clone (and update):
   381 
   400 
   382   $ hg clone -q tilde tilde2
   401   $ hg clone -q tilde tilde2
   383   $ ls tilde2
   402   abort: subrepo path contains illegal component: ~
   384   ~
   403   [255]
   385 
   404 
   386 Test direct symlink traversal
   405 Test direct symlink traversal
   387 -----------------------------
   406 -----------------------------
   388 
   407 
   389 #if symlink
   408 #if symlink