Skip to content

Instantly share code, notes, and snippets.

@larscmagnusson
Created September 20, 2019 21:07
Show Gist options
  • Save larscmagnusson/dcd056ca00525d12e9b932c42dc76ed5 to your computer and use it in GitHub Desktop.
Save larscmagnusson/dcd056ca00525d12e9b932c42dc76ed5 to your computer and use it in GitHub Desktop.
Find what commit dir is
#!/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