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
2set -eu -o pipefail
3
4git init -q
5git config commit.gpgsign false
6
7git checkout -q -b main
8git commit -q --allow-empty -m c1
9
10current_commit="$(git rev-parse HEAD)"
11
12for 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
17done
18
19git tag t1
20git tag dt1
21
22git pack-refs --all