5 #include "cache-tree.h"
6 #include "object-store.h"
7 #include "replace-object.h"
8 #include "promisor-remote.h"
9 #include "sparse-index.h"
11 #ifndef DEBUG_CACHE_TREE
12 #define DEBUG_CACHE_TREE 0
15 struct cache_tree
*cache_tree(void)
17 struct cache_tree
*it
= xcalloc(1, sizeof(struct cache_tree
));
22 void cache_tree_free(struct cache_tree
**it_p
)
25 struct cache_tree
*it
= *it_p
;
29 for (i
= 0; i
< it
->subtree_nr
; i
++)
31 cache_tree_free(&it
->down
[i
]->cache_tree
);
39 static int subtree_name_cmp(const char *one
, int onelen
,
40 const char *two
, int twolen
)
46 return memcmp(one
, two
, onelen
);
49 int cache_tree_subtree_pos(struct cache_tree
*it
, const char *path
, int pathlen
)
51 struct cache_tree_sub
**down
= it
->down
;
56 int mi
= lo
+ (hi
- lo
) / 2;
57 struct cache_tree_sub
*mdl
= down
[mi
];
58 int cmp
= subtree_name_cmp(path
, pathlen
,
59 mdl
->name
, mdl
->namelen
);
70 static struct cache_tree_sub
*find_subtree(struct cache_tree
*it
,
75 struct cache_tree_sub
*down
;
76 int pos
= cache_tree_subtree_pos(it
, path
, pathlen
);
83 ALLOC_GROW(it
->down
, it
->subtree_nr
+ 1, it
->subtree_alloc
);
86 FLEX_ALLOC_MEM(down
, name
, path
, pathlen
);
87 down
->cache_tree
= NULL
;
88 down
->namelen
= pathlen
;
90 if (pos
< it
->subtree_nr
)
91 MOVE_ARRAY(it
->down
+ pos
+ 1, it
->down
+ pos
,
92 it
->subtree_nr
- pos
- 1);
97 struct cache_tree_sub
*cache_tree_sub(struct cache_tree
*it
, const char *path
)
99 int pathlen
= strlen(path
);
100 return find_subtree(it
, path
, pathlen
, 1);
103 static int do_invalidate_path(struct cache_tree
*it
, const char *path
)
106 * ==> invalidate self
107 * ==> find "a", have it invalidate "b/c"
109 * ==> invalidate self
110 * ==> if "a" exists as a subtree, remove it.
114 struct cache_tree_sub
*down
;
117 fprintf(stderr
, "cache-tree invalidate <%s>\n", path
);
122 slash
= strchrnul(path
, '/');
123 namelen
= slash
- path
;
124 it
->entry_count
= -1;
127 pos
= cache_tree_subtree_pos(it
, path
, namelen
);
129 cache_tree_free(&it
->down
[pos
]->cache_tree
);
134 * move 4 and 5 up one place (2 entries)
135 * 2 = 6 - 3 - 1 = subtree_nr - pos - 1
137 MOVE_ARRAY(it
->down
+ pos
, it
->down
+ pos
+ 1,
138 it
->subtree_nr
- pos
- 1);
143 down
= find_subtree(it
, path
, namelen
, 0);
145 do_invalidate_path(down
->cache_tree
, slash
+ 1);
149 void cache_tree_invalidate_path(struct index_state
*istate
, const char *path
)
151 if (do_invalidate_path(istate
->cache_tree
, path
))
152 istate
->cache_changed
|= CACHE_TREE_CHANGED
;
155 static int verify_cache(struct index_state
*istate
, int flags
)
158 int silent
= flags
& WRITE_TREE_SILENT
;
160 /* Verify that the tree is merged */
162 for (i
= 0; i
< istate
->cache_nr
; i
++) {
163 const struct cache_entry
*ce
= istate
->cache
[i
];
168 fprintf(stderr
, "...\n");
171 fprintf(stderr
, "%s: unmerged (%s)\n",
172 ce
->name
, oid_to_hex(&ce
->oid
));
178 /* Also verify that the cache does not have path and path/file
179 * at the same time. At this point we know the cache has only
183 for (i
= 0; i
+ 1 < istate
->cache_nr
; i
++) {
184 /* path/file always comes after path because of the way
185 * the cache is sorted. Also path can appear only once,
186 * which means conflicting one would immediately follow.
188 const struct cache_entry
*this_ce
= istate
->cache
[i
];
189 const struct cache_entry
*next_ce
= istate
->cache
[i
+ 1];
190 const char *this_name
= this_ce
->name
;
191 const char *next_name
= next_ce
->name
;
192 int this_len
= ce_namelen(this_ce
);
193 if (this_len
< ce_namelen(next_ce
) &&
194 next_name
[this_len
] == '/' &&
195 strncmp(this_name
, next_name
, this_len
) == 0) {
197 fprintf(stderr
, "...\n");
200 fprintf(stderr
, "You have both %s and %s\n",
201 this_name
, next_name
);
209 static void discard_unused_subtrees(struct cache_tree
*it
)
211 struct cache_tree_sub
**down
= it
->down
;
212 int nr
= it
->subtree_nr
;
214 for (dst
= src
= 0; src
< nr
; src
++) {
215 struct cache_tree_sub
*s
= down
[src
];
219 cache_tree_free(&s
->cache_tree
);
226 int cache_tree_fully_valid(struct cache_tree
*it
)
231 if (it
->entry_count
< 0 || !has_object_file(&it
->oid
))
233 for (i
= 0; i
< it
->subtree_nr
; i
++) {
234 if (!cache_tree_fully_valid(it
->down
[i
]->cache_tree
))
240 static int must_check_existence(const struct cache_entry
*ce
)
242 return !(has_promisor_remote() && ce_skip_worktree(ce
));
245 static int update_one(struct cache_tree
*it
,
246 struct cache_entry
**cache
,
253 struct strbuf buffer
;
254 int missing_ok
= flags
& WRITE_TREE_MISSING_OK
;
255 int dryrun
= flags
& WRITE_TREE_DRY_RUN
;
256 int repair
= flags
& WRITE_TREE_REPAIR
;
257 int to_invalidate
= 0;
260 assert(!(dryrun
&& repair
));
265 * If the first entry of this region is a sparse directory
266 * entry corresponding exactly to 'base', then this cache_tree
267 * struct is a "leaf" in the data structure, pointing to the
268 * tree OID specified in the entry.
271 const struct cache_entry
*ce
= cache
[0];
273 if (S_ISSPARSEDIR(ce
->ce_mode
) &&
274 ce
->ce_namelen
== baselen
&&
275 !strncmp(ce
->name
, base
, baselen
)) {
277 oidcpy(&it
->oid
, &ce
->oid
);
282 if (0 <= it
->entry_count
&& has_object_file(&it
->oid
))
283 return it
->entry_count
;
286 * We first scan for subtrees and update them; we start by
287 * marking existing subtrees -- the ones that are unmarked
288 * should not be in the result.
290 for (i
= 0; i
< it
->subtree_nr
; i
++)
291 it
->down
[i
]->used
= 0;
294 * Find the subtrees and update them.
297 while (i
< entries
) {
298 const struct cache_entry
*ce
= cache
[i
];
299 struct cache_tree_sub
*sub
;
300 const char *path
, *slash
;
301 int pathlen
, sublen
, subcnt
, subskip
;
304 pathlen
= ce_namelen(ce
);
305 if (pathlen
<= baselen
|| memcmp(base
, path
, baselen
))
306 break; /* at the end of this level */
308 slash
= strchr(path
+ baselen
, '/');
314 * a/bbb/c (base = a/, slash = /c)
316 * path+baselen = bbb/c, sublen = 3
318 sublen
= slash
- (path
+ baselen
);
319 sub
= find_subtree(it
, path
+ baselen
, sublen
, 1);
320 if (!sub
->cache_tree
)
321 sub
->cache_tree
= cache_tree();
322 subcnt
= update_one(sub
->cache_tree
,
323 cache
+ i
, entries
- i
,
325 baselen
+ sublen
+ 1,
331 die("index cache-tree records empty sub-tree");
333 sub
->count
= subcnt
; /* to be used in the next loop */
334 *skip_count
+= subskip
;
338 discard_unused_subtrees(it
);
341 * Then write out the tree object for this level.
343 strbuf_init(&buffer
, 8192);
346 while (i
< entries
) {
347 const struct cache_entry
*ce
= cache
[i
];
348 struct cache_tree_sub
*sub
= NULL
;
349 const char *path
, *slash
;
351 const struct object_id
*oid
;
353 int expected_missing
= 0;
354 int contains_ita
= 0;
358 pathlen
= ce_namelen(ce
);
359 if (pathlen
<= baselen
|| memcmp(base
, path
, baselen
))
360 break; /* at the end of this level */
362 slash
= strchr(path
+ baselen
, '/');
364 entlen
= slash
- (path
+ baselen
);
365 sub
= find_subtree(it
, path
+ baselen
, entlen
, 0);
367 die("cache-tree.c: '%.*s' in '%s' not found",
368 entlen
, path
+ baselen
, path
);
370 oid
= &sub
->cache_tree
->oid
;
372 contains_ita
= sub
->cache_tree
->entry_count
< 0;
375 expected_missing
= 1;
381 entlen
= pathlen
- baselen
;
385 ce_missing_ok
= mode
== S_IFGITLINK
|| missing_ok
||
386 !must_check_existence(ce
);
387 if (is_null_oid(oid
) ||
388 (!ce_missing_ok
&& !has_object_file(oid
))) {
389 strbuf_release(&buffer
);
390 if (expected_missing
)
392 return error("invalid object %06o %s for '%.*s'",
393 mode
, oid_to_hex(oid
), entlen
+baselen
, path
);
397 * CE_REMOVE entries are removed before the index is
398 * written to disk. Skip them to remain consistent
399 * with the future on-disk index.
401 if (ce
->ce_flags
& CE_REMOVE
) {
402 *skip_count
= *skip_count
+ 1;
407 * CE_INTENT_TO_ADD entries exist on on-disk index but
408 * they are not part of generated trees. Invalidate up
409 * to root to force cache-tree users to read elsewhere.
411 if (!sub
&& ce_intent_to_add(ce
)) {
417 * "sub" can be an empty tree if all subentries are i-t-a.
419 if (contains_ita
&& is_empty_tree_oid(oid
))
422 strbuf_grow(&buffer
, entlen
+ 100);
423 strbuf_addf(&buffer
, "%o %.*s%c", mode
, entlen
, path
+ baselen
, '\0');
424 strbuf_add(&buffer
, oid
->hash
, the_hash_algo
->rawsz
);
427 fprintf(stderr
, "cache-tree update-one %o %.*s\n",
428 mode
, entlen
, path
+ baselen
);
433 struct object_id oid
;
434 hash_object_file(the_hash_algo
, buffer
.buf
, buffer
.len
,
436 if (has_object_file_with_flags(&oid
, OBJECT_INFO_SKIP_FETCH_OBJECT
))
437 oidcpy(&it
->oid
, &oid
);
441 hash_object_file(the_hash_algo
, buffer
.buf
, buffer
.len
,
442 tree_type
, &it
->oid
);
443 } else if (write_object_file(buffer
.buf
, buffer
.len
, tree_type
,
445 strbuf_release(&buffer
);
449 strbuf_release(&buffer
);
450 it
->entry_count
= to_invalidate
? -1 : i
- *skip_count
;
452 fprintf(stderr
, "cache-tree update-one (%d ent, %d subtree) %s\n",
453 it
->entry_count
, it
->subtree_nr
,
454 oid_to_hex(&it
->oid
));
459 int cache_tree_update(struct index_state
*istate
, int flags
)
463 i
= verify_cache(istate
, flags
);
468 if (!istate
->cache_tree
)
469 istate
->cache_tree
= cache_tree();
471 if (!(flags
& WRITE_TREE_MISSING_OK
) && has_promisor_remote())
472 prefetch_cache_entries(istate
, must_check_existence
);
474 trace_performance_enter();
475 trace2_region_enter("cache_tree", "update", the_repository
);
476 i
= update_one(istate
->cache_tree
, istate
->cache
, istate
->cache_nr
,
477 "", 0, &skip
, flags
);
478 trace2_region_leave("cache_tree", "update", the_repository
);
479 trace_performance_leave("cache_tree_update");
482 istate
->cache_changed
|= CACHE_TREE_CHANGED
;
486 static void write_one(struct strbuf
*buffer
, struct cache_tree
*it
,
487 const char *path
, int pathlen
)
491 /* One "cache-tree" entry consists of the following:
492 * path (NUL terminated)
493 * entry_count, subtree_nr ("%d %d\n")
494 * tree-sha1 (missing if invalid)
495 * subtree_nr "cache-tree" entries for subtrees.
497 strbuf_grow(buffer
, pathlen
+ 100);
498 strbuf_add(buffer
, path
, pathlen
);
499 strbuf_addf(buffer
, "%c%d %d\n", 0, it
->entry_count
, it
->subtree_nr
);
502 if (0 <= it
->entry_count
)
503 fprintf(stderr
, "cache-tree <%.*s> (%d ent, %d subtree) %s\n",
504 pathlen
, path
, it
->entry_count
, it
->subtree_nr
,
505 oid_to_hex(&it
->oid
));
507 fprintf(stderr
, "cache-tree <%.*s> (%d subtree) invalid\n",
508 pathlen
, path
, it
->subtree_nr
);
511 if (0 <= it
->entry_count
) {
512 strbuf_add(buffer
, it
->oid
.hash
, the_hash_algo
->rawsz
);
514 for (i
= 0; i
< it
->subtree_nr
; i
++) {
515 struct cache_tree_sub
*down
= it
->down
[i
];
517 struct cache_tree_sub
*prev
= it
->down
[i
-1];
518 if (subtree_name_cmp(down
->name
, down
->namelen
,
519 prev
->name
, prev
->namelen
) <= 0)
520 die("fatal - unsorted cache subtree");
522 write_one(buffer
, down
->cache_tree
, down
->name
, down
->namelen
);
526 void cache_tree_write(struct strbuf
*sb
, struct cache_tree
*root
)
528 trace2_region_enter("cache_tree", "write", the_repository
);
529 write_one(sb
, root
, "", 0);
530 trace2_region_leave("cache_tree", "write", the_repository
);
533 static struct cache_tree
*read_one(const char **buffer
, unsigned long *size_p
)
535 const char *buf
= *buffer
;
536 unsigned long size
= *size_p
;
539 struct cache_tree
*it
;
541 const unsigned rawsz
= the_hash_algo
->rawsz
;
544 /* skip name, but make sure name exists */
545 while (size
&& *buf
) {
555 it
->entry_count
= strtol(cp
, &ep
, 10);
559 subtree_nr
= strtol(cp
, &ep
, 10);
562 while (size
&& *buf
&& *buf
!= '\n') {
569 if (0 <= it
->entry_count
) {
572 oidread(&it
->oid
, (const unsigned char *)buf
);
578 if (0 <= it
->entry_count
)
579 fprintf(stderr
, "cache-tree <%s> (%d ent, %d subtree) %s\n",
580 *buffer
, it
->entry_count
, subtree_nr
,
581 oid_to_hex(&it
->oid
));
583 fprintf(stderr
, "cache-tree <%s> (%d subtrees) invalid\n",
584 *buffer
, subtree_nr
);
588 * Just a heuristic -- we do not add directories that often but
589 * we do not want to have to extend it immediately when we do,
592 it
->subtree_alloc
= subtree_nr
+ 2;
593 CALLOC_ARRAY(it
->down
, it
->subtree_alloc
);
594 for (i
= 0; i
< subtree_nr
; i
++) {
595 /* read each subtree */
596 struct cache_tree
*sub
;
597 struct cache_tree_sub
*subtree
;
598 const char *name
= buf
;
600 sub
= read_one(&buf
, &size
);
603 subtree
= cache_tree_sub(it
, name
);
604 subtree
->cache_tree
= sub
;
606 if (subtree_nr
!= it
->subtree_nr
)
607 die("cache-tree: internal error");
613 cache_tree_free(&it
);
617 struct cache_tree
*cache_tree_read(const char *buffer
, unsigned long size
)
619 struct cache_tree
*result
;
622 return NULL
; /* not the whole tree */
624 trace2_region_enter("cache_tree", "read", the_repository
);
625 result
= read_one(&buffer
, &size
);
626 trace2_region_leave("cache_tree", "read", the_repository
);
631 static struct cache_tree
*cache_tree_find(struct cache_tree
*it
, const char *path
)
637 struct cache_tree_sub
*sub
;
639 slash
= strchrnul(path
, '/');
641 * Between path and slash is the name of the subtree
644 sub
= find_subtree(it
, path
, slash
- path
, 0);
647 it
= sub
->cache_tree
;
656 static int write_index_as_tree_internal(struct object_id
*oid
,
657 struct index_state
*index_state
,
658 int cache_tree_valid
,
662 if (flags
& WRITE_TREE_IGNORE_CACHE_TREE
) {
663 cache_tree_free(&index_state
->cache_tree
);
664 cache_tree_valid
= 0;
667 if (!cache_tree_valid
&& cache_tree_update(index_state
, flags
) < 0)
668 return WRITE_TREE_UNMERGED_INDEX
;
671 struct cache_tree
*subtree
;
672 subtree
= cache_tree_find(index_state
->cache_tree
, prefix
);
674 return WRITE_TREE_PREFIX_ERROR
;
675 oidcpy(oid
, &subtree
->oid
);
678 oidcpy(oid
, &index_state
->cache_tree
->oid
);
683 struct tree
* write_in_core_index_as_tree(struct repository
*repo
) {
687 struct index_state
*index_state
= repo
->index
;
688 was_valid
= index_state
->cache_tree
&&
689 cache_tree_fully_valid(index_state
->cache_tree
);
691 ret
= write_index_as_tree_internal(&o
, index_state
, was_valid
, 0, NULL
);
692 if (ret
== WRITE_TREE_UNMERGED_INDEX
) {
694 fprintf(stderr
, "BUG: There are unmerged index entries:\n");
695 for (i
= 0; i
< index_state
->cache_nr
; i
++) {
696 const struct cache_entry
*ce
= index_state
->cache
[i
];
698 fprintf(stderr
, "BUG: %d %.*s\n", ce_stage(ce
),
699 (int)ce_namelen(ce
), ce
->name
);
701 BUG("unmerged index entries when writing inmemory index");
704 return lookup_tree(repo
, &index_state
->cache_tree
->oid
);
708 int write_index_as_tree(struct object_id
*oid
, struct index_state
*index_state
, const char *index_path
, int flags
, const char *prefix
)
710 int entries
, was_valid
;
711 struct lock_file lock_file
= LOCK_INIT
;
714 hold_lock_file_for_update(&lock_file
, index_path
, LOCK_DIE_ON_ERROR
);
716 entries
= read_index_from(index_state
, index_path
, get_git_dir());
718 ret
= WRITE_TREE_UNREADABLE_INDEX
;
722 was_valid
= !(flags
& WRITE_TREE_IGNORE_CACHE_TREE
) &&
723 index_state
->cache_tree
&&
724 cache_tree_fully_valid(index_state
->cache_tree
);
726 ret
= write_index_as_tree_internal(oid
, index_state
, was_valid
, flags
,
728 if (!ret
&& !was_valid
) {
729 write_locked_index(index_state
, &lock_file
, COMMIT_LOCK
);
730 /* Not being able to write is fine -- we are only interested
731 * in updating the cache-tree part, and if the next caller
732 * ends up using the old index with unupdated cache-tree part
733 * it misses the work we did here, but that is just a
734 * performance penalty and not a big deal.
739 rollback_lock_file(&lock_file
);
743 static void prime_cache_tree_rec(struct repository
*r
,
744 struct cache_tree
*it
,
747 struct tree_desc desc
;
748 struct name_entry entry
;
751 oidcpy(&it
->oid
, &tree
->object
.oid
);
752 init_tree_desc(&desc
, tree
->buffer
, tree
->size
);
754 while (tree_entry(&desc
, &entry
)) {
755 if (!S_ISDIR(entry
.mode
))
758 struct cache_tree_sub
*sub
;
759 struct tree
*subtree
= lookup_tree(r
, &entry
.oid
);
760 if (!subtree
->object
.parsed
)
762 sub
= cache_tree_sub(it
, entry
.path
);
763 sub
->cache_tree
= cache_tree();
764 prime_cache_tree_rec(r
, sub
->cache_tree
, subtree
);
765 cnt
+= sub
->cache_tree
->entry_count
;
768 it
->entry_count
= cnt
;
771 void prime_cache_tree(struct repository
*r
,
772 struct index_state
*istate
,
775 trace2_region_enter("cache-tree", "prime_cache_tree", the_repository
);
776 cache_tree_free(&istate
->cache_tree
);
777 istate
->cache_tree
= cache_tree();
779 prime_cache_tree_rec(r
, istate
->cache_tree
, tree
);
780 istate
->cache_changed
|= CACHE_TREE_CHANGED
;
781 trace2_region_leave("cache-tree", "prime_cache_tree", the_repository
);
785 * find the cache_tree that corresponds to the current level without
786 * exploding the full path into textual form. The root of the
787 * cache tree is given as "root", and our current level is "info".
788 * (1) When at root level, info->prev is NULL, so it is "root" itself.
789 * (2) Otherwise, find the cache_tree that corresponds to one level
790 * above us, and find ourselves in there.
792 static struct cache_tree
*find_cache_tree_from_traversal(struct cache_tree
*root
,
793 struct traverse_info
*info
)
795 struct cache_tree
*our_parent
;
799 our_parent
= find_cache_tree_from_traversal(root
, info
->prev
);
800 return cache_tree_find(our_parent
, info
->name
);
803 int cache_tree_matches_traversal(struct cache_tree
*root
,
804 struct name_entry
*ent
,
805 struct traverse_info
*info
)
807 struct cache_tree
*it
;
809 it
= find_cache_tree_from_traversal(root
, info
);
810 it
= cache_tree_find(it
, ent
->path
);
811 if (it
&& it
->entry_count
> 0 && oideq(&ent
->oid
, &it
->oid
))
812 return it
->entry_count
;
816 static void verify_one_sparse(struct repository
*r
,
817 struct index_state
*istate
,
818 struct cache_tree
*it
,
822 struct cache_entry
*ce
= istate
->cache
[pos
];
824 if (!S_ISSPARSEDIR(ce
->ce_mode
))
825 BUG("directory '%s' is present in index, but not sparse",
829 static void verify_one(struct repository
*r
,
830 struct index_state
*istate
,
831 struct cache_tree
*it
,
834 int i
, pos
, len
= path
->len
;
835 struct strbuf tree_buf
= STRBUF_INIT
;
836 struct object_id new_oid
;
838 for (i
= 0; i
< it
->subtree_nr
; i
++) {
839 strbuf_addf(path
, "%s/", it
->down
[i
]->name
);
840 verify_one(r
, istate
, it
->down
[i
]->cache_tree
, path
);
841 strbuf_setlen(path
, len
);
844 if (it
->entry_count
< 0 ||
845 /* no verification on tests (t7003) that replace trees */
846 lookup_replace_object(r
, &it
->oid
) != &it
->oid
)
850 pos
= index_name_pos(istate
, path
->buf
, path
->len
);
853 verify_one_sparse(r
, istate
, it
, path
, pos
);
863 while (i
< it
->entry_count
) {
864 struct cache_entry
*ce
= istate
->cache
[pos
+ i
];
866 struct cache_tree_sub
*sub
= NULL
;
867 const struct object_id
*oid
;
872 if (ce
->ce_flags
& (CE_STAGEMASK
| CE_INTENT_TO_ADD
| CE_REMOVE
))
873 BUG("%s with flags 0x%x should not be in cache-tree",
874 ce
->name
, ce
->ce_flags
);
875 name
= ce
->name
+ path
->len
;
876 slash
= strchr(name
, '/');
878 entlen
= slash
- name
;
879 sub
= find_subtree(it
, ce
->name
+ path
->len
, entlen
, 0);
880 if (!sub
|| sub
->cache_tree
->entry_count
< 0)
881 BUG("bad subtree '%.*s'", entlen
, name
);
882 oid
= &sub
->cache_tree
->oid
;
884 i
+= sub
->cache_tree
->entry_count
;
888 entlen
= ce_namelen(ce
) - path
->len
;
891 strbuf_addf(&tree_buf
, "%o %.*s%c", mode
, entlen
, name
, '\0');
892 strbuf_add(&tree_buf
, oid
->hash
, r
->hash_algo
->rawsz
);
894 hash_object_file(r
->hash_algo
, tree_buf
.buf
, tree_buf
.len
, tree_type
,
896 if (!oideq(&new_oid
, &it
->oid
))
897 BUG("cache-tree for path %.*s does not match. "
898 "Expected %s got %s", len
, path
->buf
,
899 oid_to_hex(&new_oid
), oid_to_hex(&it
->oid
));
900 strbuf_setlen(path
, len
);
901 strbuf_release(&tree_buf
);
904 void cache_tree_verify(struct repository
*r
, struct index_state
*istate
)
906 struct strbuf path
= STRBUF_INIT
;
908 if (!istate
->cache_tree
)
910 verify_one(r
, istate
, istate
->cache_tree
, &path
);
911 strbuf_release(&path
);