Created
February 14, 2012 13:02
-
-
Save cea2k/1826641 to your computer and use it in GitHub Desktop.
TRACKS CHANGES TO PARTS OF SPREE SINCE A GIVEN COMMIT
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
#!/usr/bin/env zsh | |
# 1304046900 TRACKS CHANGES TO PARTS OF SPREE SINCE A GIVEN COMMIT | |
# To be placed at 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