Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: script for creating per-file diffs against arbitrary geth commit #1212

Merged
merged 3 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ awscpu
*logs/

.vscode*
workspace.code-workspace

*.pb*

Expand All @@ -51,3 +52,6 @@ cmd/simulator/simulator

# goreleaser
dist/

# Outputs of `scripts/diff_against.sh`
diffs/
33 changes: 33 additions & 0 deletions scripts/diff_against.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

#
# Usage: scripts/diff_against.sh {geth_commit}
#
# Per-file diffs will be written to `diffs/{geth_commit}`.
#
# Example: `scripts/diff_against.sh b20b4a71598481443d60b261d3e5dcb37f8a0d82` to compare with v1.13.8.
#
# *NOTE* Before running this script:
# 1. Run `scripts/format_as_upstream.sh` to reformat this repo as `ethereum/go-ethereum`.
# 2. Add geth as a remote: `git remote add -f geth git@github.com:ethereum/go-ethereum.git`.
# 3. Find the geth commit for the latest version merged into this repo.
#

set -e;
set -u;

ROOT=$(git rev-parse --show-toplevel);
cd "${ROOT}";

BASE="${1}";

# The diffs/ directory is in .gitignore to avoid recursive diffiffiffs.
mkdir -p "diffs/${BASE}";

git diff "${BASE}" --name-only | while read -r f
do
echo "${f}";
DIR=$(dirname "${f}");
mkdir -p "diffs/${BASE}/${DIR}";
git diff "${BASE}" -- "${f}" > "diffs/${BASE}/${f}.diff";
done
Loading