Skip to content

Commit

Permalink
test script to demo post-tomono merging
Browse files Browse the repository at this point in the history
  • Loading branch information
hraban committed Jul 26, 2024
1 parent c6a7fa4 commit de1f6c5
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions test-merge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

set -euo pipefail

set -x

# The tomono script is tangled right next to the test script
export PATH="$PWD:$PATH"

d="$(mktemp -d)"
cd "$d"

# Two reasonably complex repos with lots of changes but not too many. And both
# with a ‘master’ branch.
>remotes.txt cat <<EOF
https://github.com/git/git.git git
https://git.code.sf.net/p/sbcl/sbcl sbcl
EOF

cat remotes.txt | while read url dir ; do
git clone "$url" "$dir"
(
cd "$dir"
git log --before 1.year.ago -1 --format=%h | xargs git reset --hard
)
echo "$PWD/$dir $dir" >> locals.txt
done

<locals.txt tomono

# Now we have a repo core with SBCL and Git, both where they were 1y ago. Update
# those and merge in the changes.

cat remotes.txt | while read _ dir ; do
(
cd "$dir"
git reset --hard HEAD@{1}
)
done

cd core
git fetch --all
git checkout master

cat ../remotes.txt | while read _ dir; do
git merge --no-edit -X subtree="$dir/" "$dir/master"
done

echo "Successfully merged in 1 year worth of changes from both remotes into $PWD"

0 comments on commit de1f6c5

Please sign in to comment.