We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7041e73 commit 7daca49Copy full SHA for 7daca49
gix-worktree/tests/fixtures/make_traverse_dotgit_slashes.sh
@@ -0,0 +1,27 @@
1
+#!/bin/sh
2
+set -eu
3
+
4
+readonly filename='.git/hooks/pre-commit'
5
+readonly filemode=100755
6
7
+emit_payload() {
8
+ cat <<'EOF'
9
10
+printf 'Vulnerable!\n'
11
+date >vulnerable
12
+EOF
13
+}
14
15
+repo="$1"
16
+git init -- "$repo"
17
+cd -- "$repo"
18
+branch="$(git symbolic-ref --short HEAD)"
19
20
+blob_hash="$(emit_payload | git hash-object -w --stdin)"
21
+escaped_blob_hash="$(printf '%s' "$blob_hash" | sed 's/../\\x&/g')"
22
+tree_hash="$(
23
+ printf '%s %s\0'"$escaped_blob_hash" "$filemode" "$filename" |
24
+ git hash-object -t tree -w --stdin
25
+)"
26
+commit_hash="$(git commit-tree -m 'Initial commit' "$tree_hash")"
27
+git branch -f -- "$branch" "$commit_hash"
0 commit comments