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 |