Created
September 20, 2019 21:07
-
-
Save larscmagnusson/dcd056ca00525d12e9b932c42dc76ed5 to your computer and use it in GitHub Desktop.
Find what commit dir is
This file contains 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 | |
# ANvänds = ./diff.sh swift-modularity/ Modularity/ "*.php" "." | |
DIR_1="$1" | |
DIR_2="$2" | |
GLOB="$3" | |
WHERE="$4" | |
cd $DIR_1 | |
ORIGINAL_HASH=$(git ls-files -- "$GLOB" -s "$WHERE" | git hash-object --stdin) | |
git ls-files -- "$GLOB" -s . | |
cd .. | |
cd $DIR_2 | |
git checkout master | |
while [ true ]; do | |
git checkout "HEAD^" | |
CHECKED_OUT_HASH=$(git ls-files -- "$GLOB" -s . | git hash-object --stdin) | |
if [ "$ORIGINAL_HASH" = "$CHECKED_OUT_HASH" ]; then | |
echo $CHECKED_OUT_HASH | |
echo "#################################################################################################" | |
exit | |
else | |
echo "." | |
fi | |
#sleep 1s | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment