1#include "cache.h"2#include "lockfile.h"3#include "tree.h"4#include "cache-tree.h"56static struct lock_file index_lock;78int cmd_main(int ac, const char **av)9{10setup_git_directory();11hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);12if (read_cache() < 0)13die("unable to read index file");14active_cache_tree = NULL;15if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))16die("unable to write index file");17return 0;18}