fix function name to get git-dir
use $GIT_DIR if fails to get git-dir from file path