summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-11-18 16:47:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-11-19 01:50:33 (GMT)
commit67022e02145b3be774febf38e9dc228ed11e6f25 (patch)
treec241ae71cd24dce3dbed93d0e5176c583bb77bf7 /builtin
parente092073d643b17c82d72cf692fbfaea9c9796f11 (diff)
downloadgit-67022e02145b3be774febf38e9dc228ed11e6f25.zip
git-67022e02145b3be774febf38e9dc228ed11e6f25.tar.gz
git-67022e02145b3be774febf38e9dc228ed11e6f25.tar.bz2
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 <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/grep.c3
-rw-r--r--builtin/merge-tree.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/builtin/grep.c b/builtin/grep.c
index 71df52a..64b9167 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -553,7 +553,8 @@ static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec,
if (match != all_entries_interesting) {
strbuf_addstr(&name, base->buf + tn_len);
- match = tree_entry_interesting(&entry, &name,
+ match = tree_entry_interesting(repo->index,
+ &entry, &name,
0, pathspec);
strbuf_setlen(&name, name_base_len);
diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c
index 70f6fc9..4984b7e 100644
--- a/builtin/merge-tree.c
+++ b/builtin/merge-tree.c
@@ -346,7 +346,7 @@ static void merge_trees(struct tree_desc t[3], const char *base)
setup_traverse_info(&info, base);
info.fn = threeway_callback;
- traverse_trees(3, t, &info);
+ traverse_trees(&the_index, 3, t, &info);
}
static void *get_tree_descriptor(struct tree_desc *desc, const char *rev)