150k refs consume about 10MB, git handles resolving them very quickly, too.
Unified · Split
| @@ -0,0 +1,22 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | set -eu -o pipefail | ||
| 3 | |||
| 4 | git init -q | ||
| 5 | git config commit.gpgsign false | ||
| 6 | |||
| 7 | git checkout -q -b main | ||
| 8 | git commit -q --allow-empty -m c1 | ||
| 9 | |||
| 10 | current_commit="$(git rev-parse HEAD)" | ||
| 11 | |||
| 12 | for level in $(seq -w 1000); do | ||
| 13 | mkdir -p .git/refs/heads/"$level" | ||
| 14 | for refname in $(seq 150); do | ||
| 15 | echo "$current_commit" > .git/refs/heads/"$level"/$refname | ||
| 16 | done | ||
| 17 | done | ||
| 18 | |||
| 19 | git tag t1 | ||
| 20 | git tag dt1 | ||
| 21 | |||
| 22 | git pack-refs --all | ||