def glob(repo, tree, pathname):
    if isinstance(tree, pygit2.Oid):
        tree = repo[tree]

    pathname = pathname.strip('/')
    if not has_magic(pathname):
        if path_exists(tree, pathname):
            yield pathname
        return

    dirname, basename = os.path.split(pathname)
    if not dirname:
        for name in glob1(repo, tree, os.curdir, basename):
            yield name
        return
    # `os.path.split()` returns the argument itself as a dirname if it is a
    # drive or UNC path.  Prevent an infinite recursion if a drive or UNC path
    # contains magic characters (i.e. r'\\?\C:').
    if dirname != pathname and has_magic(dirname):
        dirs = glob(repo, tree, dirname)
    else:
        dirs = [dirname]
    if has_magic(basename):
        glob_in_dir = glob1
    else:
        glob_in_dir = glob0
    for dirname in dirs:
        for name in glob_in_dir(repo, tree, dirname, basename):
            yield os.path.join(dirname, name)

# These 2 helper functions non-recursively glob inside a literal directory.
# They return a list of basenames. `glob1` accepts a pattern while `glob0`
# takes a literal basename (so it only has to check for its existence).
Return a minimum spanning tree or forest of an undirected 
dataset/ETHPy150Open bendavis78/python-gitmodel/gitmodel/utils/path.py/glob--crossover with--dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/algorithms/mst.py/minimum_spanning_tree