cache-tree: avoid infinite loop on zero-entry tree
[git/gitweb.git] / test-scrap-cache-tree.c
blob9ebcbca9d25150e9bfca77a73ca45d2a06423f49
1 #include "cache.h"
2 #include "tree.h"
3 #include "cache-tree.h"
5 static struct lock_file index_lock;
7 int main(int ac, char **av)
9 hold_locked_index(&index_lock, 1);
10 if (read_cache() < 0)
11 die("unable to read index file");
12 active_cache_tree = NULL;
13 if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
14 die("unable to write index file");
15 return 0;