2018-03-24 08:44:56 +01:00
|
|
|
#include "test-tool.h"
|
2011-12-06 18:43:35 +01:00
|
|
|
#include "cache.h"
|
2014-10-01 12:28:42 +02:00
|
|
|
#include "lockfile.h"
|
2011-12-06 18:43:35 +01:00
|
|
|
#include "tree.h"
|
|
|
|
#include "cache-tree.h"
|
|
|
|
|
|
|
|
static struct lock_file index_lock;
|
|
|
|
|
2018-03-24 08:44:56 +01:00
|
|
|
int cmd__scrap_cache_tree(int ac, const char **av)
|
2011-12-06 18:43:35 +01:00
|
|
|
{
|
2016-10-20 08:16:59 +02:00
|
|
|
setup_git_directory();
|
2016-12-07 19:33:54 +01:00
|
|
|
hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
|
2011-12-06 18:43:35 +01:00
|
|
|
if (read_cache() < 0)
|
|
|
|
die("unable to read index file");
|
|
|
|
active_cache_tree = NULL;
|
2014-06-13 14:19:23 +02:00
|
|
|
if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
|
2011-12-06 18:43:35 +01:00
|
|
|
die("unable to write index file");
|
|
|
|
return 0;
|
|
|
|
}
|