Skip to content

Commit cb3149f

Browse files
authored
Merge pull request #1698 from EliahKagan/run-ci/32bit-next
Fix generation_number_overflow 32-bit tag creation
2 parents 438ee47 + 807c51e commit cb3149f

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ jobs:
232232
- name: Make `system` scope nonempty for "GitInstallation" tests
233233
run: git config --system gitoxide.imaginary.arbitraryVariable arbitraryValue
234234
- name: Test (nextest)
235+
env:
236+
GIX_TEST_IGNORE_ARCHIVES: '1'
235237
run: cargo nextest run --workspace --no-fail-fast
236238

237239
test-32bit-cross:
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
set -eu -o pipefail
33

4-
function tick () {
4+
function tick() {
55
if test -z "${tick+set}"
66
then
77
tick=1112911993
@@ -13,9 +13,25 @@ function tick () {
1313
export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
1414
}
1515

16-
tick
17-
function commit() {
18-
local message=${1:?first argument is the commit message}
16+
function force_tag() {
17+
local name head_oid common_dir
18+
name=${1:?argument the tag name}
19+
20+
# This should only be needed with 32-bit `git`, so fail otherwise.
21+
word_size="$(
22+
git --version --build-options |
23+
awk '$1 == "sizeof-size_t:" { print $2 }'
24+
)"
25+
((word_size == 4))
26+
27+
# Manually create the tag.
28+
head_oid="$(git rev-parse HEAD)"
29+
common_dir="$(git rev-parse --git-common-dir)"
30+
(set -o noclobber; echo "$head_oid" > "$common_dir/refs/tags/$name")
31+
}
32+
33+
function tagged_commit() {
34+
local message=${1:?first argument is the commit message and tag name}
1935
local date=${2:-}
2036
local file="$message.t"
2137
echo "$1" > "$file"
@@ -26,22 +42,24 @@ function commit() {
2642
tick
2743
fi
2844
git commit -m "$message"
29-
git tag "$message"
45+
git tag -- "$message" || force_tag "$message"
3046
}
3147

48+
tick
49+
3250
# adapted from git/t/t5318 'lower layers have overflow chunk'
3351
UNIX_EPOCH_ZERO="@0 +0000"
3452
FUTURE_DATE="@4147483646 +0000"
3553

3654
git init
3755
git config commitGraph.generationVersion 2
3856

39-
commit future-1 "$FUTURE_DATE"
40-
commit old-1 "$UNIX_EPOCH_ZERO"
57+
tagged_commit future-1 "$FUTURE_DATE"
58+
tagged_commit old-1 "$UNIX_EPOCH_ZERO"
4159
git commit-graph write --reachable
42-
commit future-2 "$FUTURE_DATE"
43-
commit old-2 "$UNIX_EPOCH_ZERO"
60+
tagged_commit future-2 "$FUTURE_DATE"
61+
tagged_commit old-2 "$UNIX_EPOCH_ZERO"
4462
git commit-graph write --reachable --split=no-merge
45-
commit extra
63+
tagged_commit extra
4664
# this makes sure it's actually in chain format.
4765
git commit-graph write --reachable --split=no-merge

0 commit comments

Comments
 (0)