(git_dir, args)
return p
run git command
    args are the full command with args

    git_dir, the actual full path of the .git/ repo directory to run commands against

    returns popen object for access to stdout+stderr
run git command
    args are the full command with args
run git command args are the full command with args
def sub_git_cmd(git_dir, args):
    """
    run git command
    args are the full command with args

    git_dir, the actual full path of the .git/ repo directory to run commands against

    returns popen object for access to stdout+stderr
    """
    git_dir_to_use = None
    if os.path.exists(os.path.join(git_dir, '.git')):
        #ok file exists
        git_dir_to_use = os.path.join(git_dir, '.git')
    elif os.path.isfile(os.path.join(git_dir, '.git')):
        #it's a submodule, dereference the actual git info
        git_dir_to_use = os.path.join(git_dir, '.git')
    # else:
    #     raise Exception("Error, the .git location for %s doesn't exists" % git_dir)

    try:
        p = Popen(
            [
                'git',
                '--git-dir',
                git_dir_to_use,
            ] + args,
            stdout=PIPE, stderr=PIPE
        )
    except OSError as e:
        # Is git missing ?
        if e.errno == 2:
            e.strerror += ": git"
        raise(e)

    return p
def sub_git_cmd ( git_dir , args ) : git_dir_to_use = None if os . path . exists ( os . path . join ( git_dir , '.git' ) ) : #ok file exists git_dir_to_use = os . path . join ( git_dir , '.git' ) elif os . path . isfile ( os . path . join ( git_dir , '.git' ) ) : #it's a submodule, dereference the actual git info git_dir_to_use = os . path . join ( git_dir , '.git' ) # else: #     raise Exception("Error, the .git location for %s doesn't exists" % git_dir) try : p = Popen ( [ 'git' , '--git-dir' , git_dir_to_use , ] + args , stdout = PIPE , stderr = PIPE ) except OSError as e : # Is git missing ? if e . errno == 2 : e . strerror += ": git" raise ( e ) return p