#!/usr/bin/env bash . $(dirname $0)/util/logging.bash : ' * Have a derivative project loosely based around another (à la copy-paste) * that you would like to graft back onto the tree where it came from?? * Try hashwalker!! ' read -d '' usage </dev/null) ) declare -a smallest for (( i=${#hashes[@]} - 1 ; i>=0 ; i-- )); do # Shrek was here. changed=$(($(echo $(git diff ${hashes[i]} $branch_a --shortstat \ | grep -o '[0-9]\+\s\+' | tail -n +2) \ | sed 's/\s\+/+/g'))) if [ ${#smallest[@]} -eq 0 ]; then smallest=( ${hashes[i]} $changed ) echo -n 'f' else [ $changed -lt ${smallest[1]} ] && smallest[0]=${hashes[i]} && smallest[1]=$changed \ && echo -n '!' || echo -n '.' fi done echo echo "Smallest diff @ ${smallest[0]}: $(git diff ${smallest[0]} $branch_a --shortstat)"