aboutsummaryrefslogtreecommitdiffstats
path: root/t/helper/test-scrap-cache-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-04-29 12:59:06 -0700
committerJunio C Hamano <gitster@pobox.com>2016-04-29 12:59:06 -0700
commite0b5851907c4feb32af3b1f96200cdd6c68b524d (patch)
tree110fd45b6aefaa59feda8e53ca090ca288d7940a /t/helper/test-scrap-cache-tree.c
parente7e68265147f6aa08391b4724d862e58424b29df (diff)
parente6e7530d10b74d763b4311ea93e0a831b810d6c2 (diff)
downloadgit-e0b5851907c4feb32af3b1f96200cdd6c68b524d.tar.gz
Merge branch 'nd/test-helpers'
Sources to many test helper binaries (and the generated helpers) have been moved to t/helper/ subdirectory to reduce clutter at the top level of the tree. * nd/test-helpers: test helpers: move test-* to t/helper/ subdirectory Makefile: clean *.o files we create
Diffstat (limited to 't/helper/test-scrap-cache-tree.c')
-rw-r--r--t/helper/test-scrap-cache-tree.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/t/helper/test-scrap-cache-tree.c b/t/helper/test-scrap-cache-tree.c
new file mode 100644
index 0000000000..6efee31a48
--- /dev/null
+++ b/t/helper/test-scrap-cache-tree.c
@@ -0,0 +1,17 @@
+#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)
+{
+ hold_locked_index(&index_lock, 1);
+ if (read_cache() < 0)
+ die("unable to read index file");
+ active_cache_tree = NULL;
+ if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
+ die("unable to write index file");
+ return 0;
+}