Better way to find commit from tarball?
- From
- Todd A. Jacobs <tjacobs@si2services.com>
- Date
- Sep 6, 2010, 19:55 UTC
- Message-ID
- <AANLkTi=ZnZppPu8tT3-sUG6zZM8YnonPwMG_XZhO03up@mail.gmail.com>
Someone handed me a tarball that represented an unknown release from a project. Here's what I came up with to identify the commit:
cd $SOME_WORK_DIR
find . -path ./.git -prune -o -print0 | xargs -0 rm
tar xvfz $TARBALL
for commit in {0..100}; do
id="master~${commit}"
if git diff --quiet --exit-code "$id"
then
echo "Matched on commit $id"
break
fi
doneSomeone please tell me there's an easier way to find a matching tree when handed a tarball. This works, but seems cumbersome.