Skip to content
Bitcoin Roots

v31.1-roots.1 · Commit 8: [PATCH 08/17] chore(roots): integrate v31 identity and maintenance tooling

ci/release/create-patch-series.sh

Before: /dev/null · After: ci/release/create-patch-series.sh

File metadata
new file mode 100755
index 0000000000000000000000000000000000000000..6dd11182629271c1feefbc33117b96032473a510

Download original patch · Release notes

Diff rows 1–69 of 69. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.

ci/release/create-patch-series.sh ADDED
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env bash
2
+ # Copyright (c) 2026-present The Bitcoin Roots developers
3
+ # Distributed under the MIT software license, see the accompanying
4
+ # file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
+
6
+ export LC_ALL=C
7
+ set -Eeuo pipefail
8
+
9
+ if [[ "$#" -ne 2 ]]; then
10
+ printf 'Usage: %s RELEASE_TAG OUTPUT_FILE\n' "$0" >&2
11
+ exit 2
12
+ fi
13
+
14
+ release_tag=$1
15
+ output_file=$2
16
+ script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
17
+ "$script_dir/validate-release-source.sh" "$release_tag"
18
+
19
+ version=${release_tag#v}
20
+ core_version=${version%%-roots.*}
21
+ core_ref="${RELEASE_CORE_REF:-refs/tags/v${core_version}}"
22
+ core_commit="$(git rev-parse --verify "${core_ref}^{commit}")"
23
+ tag_commit="$(git rev-parse --verify "refs/tags/${release_tag}^{commit}")"
24
+
25
+ output_parent=${output_file%/*}
26
+ if [[ "$output_parent" == "$output_file" ]]; then
27
+ output_parent=.
28
+ fi
29
+ mkdir -p -- "$output_parent"
30
+ output_parent="$(cd -- "$output_parent" && pwd -P)"
31
+ output_path="$output_parent/${output_file##*/}"
32
+ patch_tmp="$(mktemp "$output_parent/.roots-patch.XXXXXX")"
33
+ replay_dir="$(mktemp -d)"
34
+
35
+ cleanup() {
36
+ rm -f -- "$patch_tmp"
37
+ rm -rf -- "$replay_dir"
38
+ }
39
+ trap cleanup EXIT
40
+
41
+ # GitHub workflow and repository-management files belong to the canonical
42
+ # branch and tag, but they are not part of the portable Roots product patch.
43
+ git format-patch --stdout --binary --full-index --base="$core_commit" \
44
+ "${core_commit}..${tag_commit}" -- . ':(exclude).github/**' > "$patch_tmp"
45
+ if [[ ! -s "$patch_tmp" ]]; then
46
+ printf 'Generated patch series is empty for %s\n' "$release_tag" >&2
47
+ exit 1
48
+ fi
49
+
50
+ git clone --quiet --no-hardlinks --shared . "$replay_dir/repository"
51
+ git -C "$replay_dir/repository" checkout --quiet --detach "$core_commit"
52
+ git -C "$replay_dir/repository" \
53
+ -c user.name='Bitcoin Roots release verification' \
54
+ -c user.email='release-verification@invalid' \
55
+ am -3 --keep-cr "$patch_tmp" >/dev/null
56
+
57
+ if ! git -C "$replay_dir/repository" diff --quiet \
58
+ "$tag_commit" HEAD -- . ':(exclude).github/**'; then
59
+ printf 'Patch replay differs from release tag %s outside .github\n' "$release_tag" >&2
60
+ exit 1
61
+ fi
62
+ if ! git -C "$replay_dir/repository" diff --quiet \
63
+ "$core_commit" HEAD -- .github; then
64
+ printf 'Patch replay unexpectedly changes .github for %s\n' "$release_tag" >&2
65
+ exit 1
66
+ fi
67
+
68
+ mv -f -- "$patch_tmp" "$output_path"
69
+ printf '%s\n' "$output_path"