def tree_decode(buf):
 ofs = 0
 while (ofs < len(buf)):
  z = buf.find('\x00', ofs)
  assert (z > ofs)
  spl = buf[ofs:z].split(' ', 1)
  assert (len(spl) == 2)
  (mode, name) = spl
  sha = buf[(z + 1):((z + 1) + 20)]
  ofs = ((z + 1) + 20)
  (yield (int(mode, 8), name, sha))

def tree_decode ( buf ) : ofs = 0 while ( ofs < len ( buf ) ) : z = buf . find ( '\x00' , ofs ) assert ( z > ofs ) spl = buf [ ofs : z ] . split ( ' ' , 1 ) assert ( len ( spl ) == 2 ) ( mode , name ) = spl sha = buf [ ( z + 1 ) : ( ( z + 1 ) + 20 ) ] ofs = ( ( z + 1 ) + 20 ) ( yield ( int ( mode , 8 ) , name , sha ) )
generate a list of from the git tree object in buf .