def _remove_git_file_if_invalid(git_file_path):
 with open(git_file_path, 'rb') as fp:
  contents = fp.read(10000).decode('utf-8')
 if contents.startswith('gitdir: '):
  gitdir = contents.split(' ', 1)[1].rstrip()
  if (not os.path.isabs(gitdir)):
   gitdir = os.path.join(os.path.dirname(git_file_path), gitdir)
  if (not os.path.exists(gitdir)):
   os.remove(git_file_path)

def _remove_git_file_if_invalid ( git_file_path ) : with open ( git_file_path , 'rb' ) as fp : contents = fp . read ( 10000 ) . decode ( 'utf-8' ) if contents . startswith ( 'gitdir: ' ) : gitdir = contents . split ( ' ' , 1 ) [ 1 ] . rstrip ( ) if ( not os . path . isabs ( gitdir ) ) : gitdir = os . path . join ( os . path . dirname ( git_file_path ) , gitdir ) if ( not os . path . exists ( gitdir ) ) : os . remove ( git_file_path )
remove invalid .