Skip to content

Instantly share code, notes, and snippets.

@bashcoder
Created February 16, 2012 16:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bashcoder/1846286 to your computer and use it in GitHub Desktop.
Save bashcoder/1846286 to your computer and use it in GitHub Desktop.
TRACKS CHANGES TO PARTS OF SPREE SINCE A GIVEN COMMIT
#!/usr/bin/env zsh
# 1304046900 TRACKS CHANGES TO PARTS OF SPREE SINCE A GIVEN COMMIT
# To be placed in the root of your app.
old_commit="29e3d4f707bdb047a6fabc2543247139027b06fb"
parts=(
core/app/views
core/config/locales/en.yml
core/lib/generators/spree/install/templates
)
# Exit on failure
#
set -e
git clone git://github.com/spree/spree.git tmp/spree_check
cd tmp/spree_check
if output=$(git diff --exit-code --name-status "$old_commit" HEAD -- "${parts[@]}"); then
echo "No changes"
else
# Group name statuses
#
while read -r line; do
case $line in
(M*) modified+=("$line") ;;
(A*) added+=("$line") ;;
(D*) deleted+=("$line") ;;
esac
done <<< "$output"
# Display groups
#
if [[ -n $modified ]]; then
print -l -- "${modified[@]}"
echo
fi
if [[ -n $added ]]; then
print -l -- "${added[@]}"
echo
fi
if [[ -n $deleted ]]; then
print -l -- "${deleted[@]}"
echo
fi
echo "You are now at: $(git rev-parse HEAD)"
fi
cd ../../
rm -r tmp/spree_check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment