def is_git_dir(d):
 if osp.isdir(d):
  if (osp.isdir(osp.join(d, 'objects')) and osp.isdir(osp.join(d, 'refs'))):
   headref = osp.join(d, 'HEAD')
   return (osp.isfile(headref) or (osp.islink(headref) and os.readlink(headref).startswith('refs')))
  elif (osp.isfile(osp.join(d, 'gitdir')) and osp.isfile(osp.join(d, 'commondir')) and osp.isfile(osp.join(d, 'gitfile'))):
   raise WorkTreeRepositoryUnsupported(d)
 return False

def is_git_dir ( d ) : if osp . isdir ( d ) : if ( osp . isdir ( osp . join ( d , 'objects' ) ) and osp . isdir ( osp . join ( d , 'refs' ) ) ) : headref = osp . join ( d , 'HEAD' ) return ( osp . isfile ( headref ) or ( osp . islink ( headref ) and os . readlink ( headref ) . startswith ( 'refs' ) ) ) elif ( osp . isfile ( osp . join ( d , 'gitdir' ) ) and osp . isfile ( osp . join ( d , 'commondir' ) ) and osp . isfile ( osp . join ( d , 'gitfile' ) ) ) : raise WorkTreeRepositoryUnsupported ( d ) return False
from gits setup .