aboutsummaryrefslogtreecommitdiff
path: root/test-scrap-cache-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-04-09 13:40:32 -0700
committerJunio C Hamano <gitster@pobox.com>2012-04-09 13:40:32 -0700
commit6d5c16a90ccf5724fb885d4b8af295c640da33a4 (patch)
treedf8b5876c2667924dbf78515091b2ec543ad597d /test-scrap-cache-tree.c
parent00fb2d25632191b89ac4144e1a6498470a4a1c9e (diff)
parent4cd675565647b2ccacdd6c93841b4ff06c32b16a (diff)
downloadgit-6d5c16a90ccf5724fb885d4b8af295c640da33a4.tar.gz
git-6d5c16a90ccf5724fb885d4b8af295c640da33a4.tar.xz
Merge branch 'tr/cache-tree' into maint-1.7.8
* tr/cache-tree: t0090: be prepared that 'wc -l' writes leading blanks reset: update cache-tree data when appropriate commit: write cache-tree data when writing index anyway Refactor cache_tree_update idiom from commit Test the current state of the cache-tree optimization Add test-scrap-cache-tree
Diffstat (limited to 'test-scrap-cache-tree.c')
-rw-r--r--test-scrap-cache-tree.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/test-scrap-cache-tree.c b/test-scrap-cache-tree.c
new file mode 100644
index 000000000..472801391
--- /dev/null
+++ b/test-scrap-cache-tree.c
@@ -0,0 +1,17 @@
+#include "cache.h"
+#include "tree.h"
+#include "cache-tree.h"
+
+static struct lock_file index_lock;
+
+int main(int ac, char **av)
+{
+ int fd = hold_locked_index(&index_lock, 1);
+ if (read_cache() < 0)
+ die("unable to read index file");
+ active_cache_tree = NULL;
+ if (write_cache(fd, active_cache, active_nr)
+ || commit_lock_file(&index_lock))
+ die("unable to write index file");
+ return 0;
+}