Skip to content

Instantly share code, notes, and snippets.

@rickychien
Last active August 29, 2015 14:11
Show Gist options
  • Save rickychien/5fb0f4aa6e6eace5222b to your computer and use it in GitHub Desktop.
Save rickychien/5fb0f4aa6e6eace5222b to your computer and use it in GitHub Desktop.
Compare difference between two commits (HEAD and HEAD^) for gaia profile (Usage: ./diff-build.sh)
#!/bin/bash
REV1=HEAD
REV2=HEAD^
if [ -z "$REV1" -o -z "$REV2" ]; then
echo "Usage: $0 REV1 REV2";
exit 1;
fi
compute_profile () {
REV=$1
if [ ! -d diffs/profiles/$REV ]; then
git checkout $REV
make clean
make
mv profile diffs/profiles/$REV
fi
}
unzip_profile () {
REV=$1
if [ ! -d diffs/unzip/$REV ]; then
mkdir -p diffs/unzip/$REV
cp -r diffs/profiles/$REV/* diffs/unzip/$REV/
ZIPS=$(find diffs/unzip/$REV/ -name *.zip)
for ZIP in $ZIPS; do
unzip -q -d $(echo $ZIP | sed 's/\.zip$/\.unzip/') $ZIP
rm $ZIP
done;
fi
}
cd gaia
mkdir -p diffs/profiles
compute_profile $REV1
compute_profile $REV2
mkdir -p diffs/unzip
unzip_profile $REV1
unzip_profile $REV2
cd diffs/unzip && diff --brief -r $REV1 $REV2
echo ""
echo "For more details, run:"
echo " diff -r diffs/unzip/$REV1 diffs/unzip/$REV2"
echo " or same with meld, kdiff3,..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment