def glob1(repo, tree, dirname, pattern):
    if not dirname:
        dirname = os.curdir
    if isinstance(pattern, unicode) and not isinstance(dirname, unicode):
        dirname = unicode(dirname, sys.getfilesystemencoding() or
                          sys.getdefaultencoding())
    if dirname != os.curdir:
        try:
            tree = repo[tree[dirname].oid]
        except __HOLE__:
            return []
    names = [e.name for e in tree]
    if pattern[0] != '.':
        names = filter(lambda n: n[0] != '.', names)
    return fnmatch.filter(names, pattern)
dataset/ETHPy150Open bendavis78/python-gitmodel/gitmodel/utils/path.py/glob1