def find_file(self, path, tgt_env):
        tree = self.get_tree(tgt_env)
        if not tree:
            # Branch/tag/SHA not found
            return None, None
        blob = None
        depth = 0
        while True:
            depth += 1
            if depth > SYMLINK_RECURSE_DEPTH:
                break
            try:
                file_blob = tree / path
                if stat.S_ISLNK(file_blob.mode):
                    # Path is a symlink. The blob data corresponding to
                    # this path's object ID will be the target of the
                    # symlink. Follow the symlink and set path to the
                    # location indicated in the blob data.
                    stream = six.StringIO()
                    file_blob.stream_data(stream)
                    stream.seek(0)
                    link_tgt = stream.read()
                    stream.close()
                    path = os.path.normpath(
                        os.path.join(os.path.dirname(path), link_tgt)
                    )
                else:
                    blob = file_blob
                    break
            except KeyError:
                # File not found or repo_path points to a directory
                break
        return blob, blob.hexsha if blob is not None else blob
Find the specified file in the specified environment
dataset/ETHPy150Open saltstack/salt/salt/utils/gitfs.py/GitPython.find_file