def _get_toplevel(path, user=None, password=None):
 return _git_run(['git', 'rev-parse', '--show-toplevel'], cwd=path, user=user, password=password)['stdout']

def _get_toplevel ( path , user = None , password = None ) : return _git_run ( [ 'git' , 'rev-parse' , '--show-toplevel' ] , cwd = path , user = user , password = password ) [ 'stdout' ]
use git rev-parse to return the top level of a repo .