def write_cache_entry(f, entry):
 beginoffset = f.tell()
 (name, ctime, mtime, dev, ino, mode, uid, gid, size, sha, flags) = entry
 write_cache_time(f, ctime)
 write_cache_time(f, mtime)
 flags = (len(name) | (flags & (~ 4095)))
 f.write(struct.pack('>LLLLLL20sH', (dev & 4294967295), (ino & 4294967295), mode, uid, gid, size, hex_to_sha(sha), flags))
 f.write(name)
 real_size = (((f.tell() - beginoffset) + 8) & (~ 7))
 f.write(('\x00' * ((beginoffset + real_size) - f.tell())))

def write_cache_entry ( f , entry ) : beginoffset = f . tell ( ) ( name , ctime , mtime , dev , ino , mode , uid , gid , size , sha , flags ) = entry write_cache_time ( f , ctime ) write_cache_time ( f , mtime ) flags = ( len ( name ) | ( flags & ( ~ 4095 ) ) ) f . write ( struct . pack ( '>LLLLLL20sH' , ( dev & 4294967295 ) , ( ino & 4294967295 ) , mode , uid , gid , size , hex_to_sha ( sha ) , flags ) ) f . write ( name ) real_size = ( ( ( f . tell ( ) - beginoffset ) + 8 ) & ( ~ 7 ) ) f . write ( ( '\x00' * ( ( beginoffset + real_size ) - f . tell ( ) ) ) )
write an index entry to a file .