Last active
February 4, 2016 18:59
-
-
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…
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
#!/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 |
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
Example output;