Skip to content

Commit 78ef30c

Browse files
committed
chore: document cherrypick.sh and use HEAD instead of main
1 parent 6e61742 commit 78ef30c

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed
Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,47 @@
11
#!/usr/bin/env bash
22

3+
# Copyright 2025 the libevm authors.
4+
#
5+
# The libevm additions to go-ethereum are free software: you can redistribute
6+
# them and/or modify them under the terms of the GNU Lesser General Public License
7+
# as published by the Free Software Foundation, either version 3 of the License,
8+
# or (at your option) any later version.
9+
#
10+
# The libevm additions are distributed in the hope that they will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
13+
# General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Lesser General Public License
16+
# along with the go-ethereum library. If not, see
17+
# <http://www.gnu.org/licenses/>.
18+
19+
# Usage: run `./cherrypick.sh` on a branch intended to become a release.
20+
#
21+
# Reads the contents of ./cherrypicks, filters out commits that are already
22+
# ancestors of HEAD, and calls `git cherry-pick` with the remaining commit
23+
# hashes.
24+
325
set -eu;
426
set -o pipefail;
527

628
SELF_DIR=$(dirname $0)
729
# The format of the `cherrypicks` file is guaranteed by a test so we can use simple parsing here.
830
CHERRY_PICKS=$(cat "${SELF_DIR}/cherrypicks" | grep -Pv "^#" | awk '{print $1}')
9-
RELEASE_REF="main";
1031

1132
commits=()
1233
for commit in ${CHERRY_PICKS}; do
13-
git merge-base --is-ancestor "${commit}" "${RELEASE_REF}" && \
34+
git merge-base --is-ancestor "${commit}" HEAD && \
1435
echo "Skipping ${commit} already in history" && \
1536
continue;
1637

1738
echo "Cherry-picking ${commit}";
1839
commits+=("${commit}");
1940
done
2041

42+
if [[ -z "${commits[@]// }" ]]; then # $x// removes whitespace
43+
echo "No commits to cherry-pick";
44+
exit 0;
45+
fi
46+
2147
git cherry-pick "${commits[@]}";

0 commit comments

Comments
 (0)