t / helper / test-scrap-cache-tree.con commit lock_file: move static locks into functions (0fa5a2e)
   1#include "cache.h"
   2#include "lockfile.h"
   3#include "tree.h"
   4#include "cache-tree.h"
   5
   6int cmd_main(int ac, const char **av)
   7{
   8        struct lock_file index_lock = LOCK_INIT;
   9
  10        setup_git_directory();
  11        hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
  12        if (read_cache() < 0)
  13                die("unable to read index file");
  14        active_cache_tree = NULL;
  15        if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
  16                die("unable to write index file");
  17        return 0;
  18}