Skip to content

Commit bf49d73

Browse files
committed
Hard-code target to fix remaining replacement bugs
+ Refactor for brevity.
1 parent 7fa0185 commit bf49d73

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

gix-worktree/tests/fixtures/make_traverse_dotdot_trees.sh

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,10 @@
33
set -eu
44

55
repo="$1"
6-
bin='.cargo/bin'
76

87
git init -- "$repo"
98
cd -- "$repo"
109

11-
for dir in .a .b .c .d .e .f .g .h .i .j; do
12-
mkdir -- "$dir"
13-
touch -- "$dir/.keep"
14-
done
15-
1610
cat >ls.tmp <<'EOF'
1711
#!/bin/sh
1812
printf 'Vulnerable!\n'
@@ -21,13 +15,15 @@ exec /bin/ls "$@"
2115
EOF
2216

2317
upward='..'
24-
for dir in .a .b .c .d .e .f .g .h .i .j; do
25-
upward="../$upward" # So .a has ../.., then .b has ../../.., and so on.
26-
cp -- ls.tmp "$(printf '%s' "$dir/$upward/$bin/ls" | tr / @)"
18+
for subdir in .a .b .c .d .e .f .g .h .i .j; do
19+
upward="..@$upward"
20+
cp -- ls.tmp "$subdir@$upward@.cargo@bin@ls"
21+
mkdir -- "$subdir"
22+
touch -- "$subdir/.keep"
2723
done
2824

2925
rm ls.tmp
3026
git add .
31-
ex -s -c '%s/@\.\./\/../g' -c 'x' .git/index # Replace each "@.." with "/..".
27+
ex -s -c '%s/@\.\./\/../g' -c '%s/@\.cargo@bin@ls/\/.cargo\/bin\/ls/g' -c 'x' .git/index
3228
git commit -m 'Initial commit'
3329
git show --stat

0 commit comments

Comments
 (0)