()
return commit, msg
returns the commit and message of the current git HEAD
returns the commit and message of the current git HEAD
returns the commit and message of the current git HEAD
def get_git_head():
    """returns the commit and message of the current git HEAD"""

    try:
        pr = subprocess.Popen(
            "/usr/bin/git log -n 1 --oneline".split(),
            cwd=settings.BASE_DIR,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
        )

    except OSError:
        return None, None

    (out, err) = pr.communicate()
    if err:
        return None, None

    outs = [o.decode("utf-8") for o in out.split()]
    commit = outs[0]
    msg = " ".join(outs[1:])
    return commit, msg
def get_git_head ( ) : try : pr = subprocess . Popen ( "/usr/bin/git log -n 1 --oneline" . split ( ) , cwd = settings . BASE_DIR , stdout = subprocess . PIPE , stderr = subprocess . PIPE , ) except OSError : return None , None ( out , err ) = pr . communicate ( ) if err : return None , None outs = [ o . decode ( "utf-8" ) for o in out . split ( ) ] commit = outs [ 0 ] msg = " " . join ( outs [ 1 : ] ) return commit , msg