You can capture the full path of a file in every commit, if you know its name, using ls-tree -r with a grep:
#!/bin/bash
filename_to_look_for=SpecRunner.html
commit_range=1cb1d..e172
echo Looking for file $filename_to_look_for in commit range $commit_range
echo
list_of_commits=($(git rev-list $commit_range))
num_of_commits=${#list_of_commits[@]}
look_for_file_in_commit() { git ls-tree -r $1 | grep $filename_to_look_for; }
for c in "${list_of_commits[@]}"
do
echo Commit $c ":"
look_for_file_in_commit $c
echo
done
This is an example of an output:
$ bash lstree.sh
Looking for file SpecRunner.html in commit range 1cb1d..e172
Commit e172774592f13c9fc1bdcd22099e1a104c5d1208 :
100644 blob 33ce97139315d7240ea3d09a5c62f5ea89887cd7 TestPlans/e2e/SpecRunner.html
Commit 14310bc0cf69967d4781e0aec2fd2cca21d72ac6 :
100644 blob 33ce97139315d7240ea3d09a5c62f5ea89887cd7 TestPlans/e2e/SpecRunner.html
Commit 20e22a4b88f36f1f9109680c0bed8b6b28941e9f :
100644 blob 33ce97139315d7240ea3d09a5c62f5ea89887cd7 TestPlans/e2e/SpecRunner.html
Commit fb80ab129f10225117c7a8b25ab51d1e7842e752 :
100644 blob 33ce97139315d7240ea3d09a5c62f5ea89887cd7 TestPlans/e2e/SpecRunner.html
Commit 8d67498dd04ddb1bd27fd110554021d2a7b7c7f1 :
100644 blob 33ce97139315d7240ea3d09a5c62f5ea89887cd7 TestPlans/e2e/SpecRunner.html