Skip to content

Instantly share code, notes, and snippets.

@peterjaap
Last active February 4, 2016 18:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterjaap/720ebff36062eec584cc to your computer and use it in GitHub Desktop.
Save peterjaap/720ebff36062eec584cc to your computer and use it in GitHub Desktop.
This small script lists files that have significant changes done to them with the last Magento upgrade. Run this under the same user that did the update. It'll ignore files that are new or only have changes in the comment section (ie Copyright update). Use the upgrade git commit reference hash as your first argument. This script assumes your Mag…
#!/bin/bash
if [ ! "$1" ]; then
echo "No commit reference found! Please add the commit hash of your upgrade."
exit
fi
function echocolor() { # $1 = string
COLOR='\033[1;33m'
NC='\033[0m'
printf "${COLOR}$1${NC}\n"
}
git show --name-only $1 > /tmp/tmp_filenames_magento_upgrade.txt
tail -n +7 /tmp/tmp_filenames_magento_upgrade.txt > /tmp/tmp_filenames_magento_upgrade_without_header.txt
userWhoDidTheUpdate="$(whoami)"
while read p; do
if [ -f $p ]; then
linesChanged="$(git blame $p | grep $userWhoDidTheUpdate | wc -l | xargs)"
numberOfCommits="$(git log --pretty=oneline $p | wc -l | xargs)"
if [ $linesChanged != '1' ] && [ $numberOfCommits != '1' ]; then
echocolor "Lines changed: $linesChanged, commits: $numberOfCommits \t\t $p"
echo "$(git log --pretty=oneline $p)"
echo " "
fi
fi
done </tmp/tmp_filenames_magento_upgrade_without_header.txt
@peterjaap
Copy link
Author

Example output;

screenshot 2016-01-31 11 02 42

@peterjaap
Copy link
Author

Extra trick; on line 25, add 'grep -v COMMITHASH1|COMMITHASH2' etc etc to the git log call to filter out known commits such as your previous upgrade commits or commits that contain SUPEE patches.

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