t / helper / test-write-cache.con commit Merge branch 'sg/test-rebase-editor-fix' into maint (a4830a7)
   1#include "test-tool.h"
   2#include "cache.h"
   3#include "lockfile.h"
   4
   5int cmd__write_cache(int argc, const char **argv)
   6{
   7        struct lock_file index_lock = LOCK_INIT;
   8        int i, cnt = 1;
   9        if (argc == 2)
  10                cnt = strtol(argv[1], NULL, 0);
  11        setup_git_directory();
  12        read_cache();
  13        for (i = 0; i < cnt; i++) {
  14                hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
  15                if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
  16                        die("unable to write index file");
  17        }
  18
  19        return 0;
  20}