http-backend test: make empty CONTENT_LENGTH test more realistic
[gitweb.git] / t / helper / test-scrap-cache-tree.c
index 6efee31a4867b4ff8493161376e5a9cfdd48fe44..393f1604ff954703a2a5e075fbda1e14d0827dc0 100644 (file)
@@ -1,13 +1,15 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "lockfile.h"
 #include "tree.h"
 #include "cache-tree.h"
 
-static struct lock_file index_lock;
-
-int main(int ac, char **av)
+int cmd__scrap_cache_tree(int ac, const char **av)
 {
-       hold_locked_index(&index_lock, 1);
+       struct lock_file index_lock = LOCK_INIT;
+
+       setup_git_directory();
+       hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
        if (read_cache() < 0)
                die("unable to read index file");
        active_cache_tree = NULL;