path: root/tree-walk.h
diff options
authorNguyễn Thái Ngọc Duy <>2018-11-18 16:47:57 (GMT)
committerJunio C Hamano <>2018-11-19 01:50:33 (GMT)
commit67022e02145b3be774febf38e9dc228ed11e6f25 (patch)
treec241ae71cd24dce3dbed93d0e5176c583bb77bf7 /tree-walk.h
parente092073d643b17c82d72cf692fbfaea9c9796f11 (diff)
tree-walk.c: make tree_entry_interesting() take an index
In order to support :(attr) when matching pathspec on a tree, tree_entry_interesting() needs to take an index (because git_check_attr() needs it). This is the preparation step for it. This also makes it clearer what index we fall back to when looking up attributes during an unpack-trees operation: the source index. This also fixes revs->pruning.repo initialization that should have been done in 2abf350385 (revision.c: remove implicit dependency on the_index - 2018-09-21). Without it, skip_uninteresting() will dereference a NULL pointer through this call chain get_revision(revs) get_revision_internal get_revision_1 try_to_simplify_commit rev_compare_tree diff_tree_oid(..., &revs->pruning) ll_diff_tree_oid diff_tree_paths ll_diff_tree skip_uninteresting Signed-off-by: Nguyễn Thái Ngọc Duy <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'tree-walk.h')
1 files changed, 6 insertions, 4 deletions
diff --git a/tree-walk.h b/tree-walk.h
index 1968310..eefd26b 100644
--- a/tree-walk.h
+++ b/tree-walk.h
@@ -1,6 +1,7 @@
#ifndef TREE_WALK_H
#define TREE_WALK_H
+struct index_state;
struct strbuf;
struct name_entry {
@@ -48,7 +49,7 @@ void *fill_tree_descriptor(struct tree_desc *desc, const struct object_id *oid);
struct traverse_info;
typedef int (*traverse_callback_t)(int n, unsigned long mask, unsigned long dirmask, struct name_entry *entry, struct traverse_info *);
-int traverse_trees(int n, struct tree_desc *t, struct traverse_info *info);
+int traverse_trees(struct index_state *istate, int n, struct tree_desc *t, struct traverse_info *info);
enum follow_symlinks_result {
FOUND = 0, /* This includes out-of-tree links */
@@ -98,8 +99,9 @@ enum interesting {
all_entries_interesting = 2 /* yes, and all subsequent entries will be */
-extern enum interesting tree_entry_interesting(const struct name_entry *,
- struct strbuf *, int,
- const struct pathspec *ps);
+enum interesting tree_entry_interesting(struct index_state *istate,
+ const struct name_entry *,
+ struct strbuf *, int,
+ const struct pathspec *ps);