Skip to content

Instantly share code, notes, and snippets.

@offby1
Created March 11, 2012 20:23
Show Gist options
  • Select an option

  • Save offby1/2018085 to your computer and use it in GitHub Desktop.

Select an option

Save offby1/2018085 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="32483802d823e92c0746d080217870dd48f49307"
parts=(
core/app/assets/javascripts/store/checkout.js
core/app/helpers/spree/base_helper.rb
core/app/helpers/spree/checkout_helper.rb
core/app/views/spree
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 flag file; do
case $flag in
(M*) modified+=($file) ;;
(A*) added+=($file) ;;
(D*) deleted+=($file) ;;
esac
done <<< $output
# Display groups
#
if [[ -n $modified ]]; then
print -f "M %s\n" $modified
echo
fi
if [[ -n $added ]]; then
print -f "A %s\n" $added
echo
fi
if [[ -n $deleted ]]; then
print -f "D %s\n" $deleted
echo
fi
print -n "Show full git-diff of modified files? (Y/n) "
if read -q; then
git diff $old_commit HEAD -- $modified | awk 'NR>1 && /^diff/ {print ; print "###"} {print}'
fi
echo
print "You are now at: $(git rev-parse HEAD)"
fi
cd ../../
rm -r tmp/spree_check
@snogglethorpe
Copy link
Copy Markdown

can't you just follow the trail of bodies?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment