Last active
September 18, 2019 12:54
-
-
Save bbannier/f19dfc0bdd65a2d7977ff3f2624aa990 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eux | |
DCOS="$HOME"/src/dcos | |
MESOS="$HOME"/src/mesos | |
COMMIT=$1 | |
# Check if Mesos commit $1 contains $2. | |
contains() { | |
git --git-dir="$MESOS"/.git rev-list "$1" | grep -q "$2" | |
} | |
# Check if commit has already landed in dcos. | |
contains "$(jq -r '.single_source.ref' "$DCOS"/packages/mesos/buildinfo.json)" "$COMMIT" || (echo "$COMMIT has not landed" && exit 1) | |
LAST_REV= | |
for rev in $(git --git-dir="$DCOS/.git" rev-list HEAD -- packages/mesos/buildinfo.json); do | |
LAST_REV="$rev" | |
contains "$(git show "$rev":packages/mesos/buildinfo.json | jq -r '.single_source.ref')" "$COMMIT" || break | |
done | |
if [ -z "$LAST_REV" ]; then | |
echo "Could not find commit introducing $COMMIT" | |
exit 1 | |
fi | |
git --git-dir="$DCOS/.git" show "$LAST_REV" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment