History

[git-refs] a way to build a big packed-refs file

150k refs consume about 10MB, git handles resolving them very quickly, too.

Sebastian Thiel committed 5 years ago

Commit 51135291 parent b9d77221 file · +22 −0Browse files

Unified · Split

git-ref/tests/fixtures/make_repository_with_lots_of_refs.sh+22−0
@@ -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