'Write current contents of index to disk.'

def write(self):

    f = GitFile(self._filename, 'wb')
    try:
        f = SHA1Writer(f)
        write_index_dict(f, self._byname)
    finally:
        f.close()
