def read_gitfile(f):
 cs = f.read()
 if (not cs.startswith('gitdir: ')):
  raise ValueError("Expected file to start with 'gitdir: '")
 return cs[len('gitdir: '):].rstrip('\n')

def read_gitfile ( f ) : cs = f . read ( ) if ( not cs . startswith ( 'gitdir: ' ) ) : raise ValueError ( "Expected file to start with 'gitdir: '" ) return cs [ len ( 'gitdir: ' ) : ] . rstrip ( '\n' )
read a .