diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-01-15 00:29:28 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-01-15 00:29:28 +0100 |
commit | d6f05a435f9c89f8c9860c7af692942768d81584 (patch) | |
tree | 7b43bdb292f9cda801778647a67ddc2662504067 /builtin | |
parent | Merge branch 'md/list-lazy-objects-fix' (diff) | |
parent | tree-walk: support :(attr) matching (diff) | |
download | git-d6f05a435f9c89f8c9860c7af692942768d81584.tar.xz git-d6f05a435f9c89f8c9860c7af692942768d81584.zip |
Merge branch 'nd/attr-pathspec-in-tree-walk'
The traversal over tree objects has learned to honor
":(attr:label)" pathspec match, which has been implemented only for
enumerating paths on the filesystem.
* nd/attr-pathspec-in-tree-walk:
tree-walk: support :(attr) matching
dir.c: move, rename and export match_attrs()
pathspec.h: clean up "extern" in function declarations
tree-walk.c: make tree_entry_interesting() take an index
tree.c: make read_tree*() take 'struct repository *'
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/checkout.c | 3 | ||||
-rw-r--r-- | builtin/grep.c | 3 | ||||
-rw-r--r-- | builtin/log.c | 5 | ||||
-rw-r--r-- | builtin/ls-files.c | 2 | ||||
-rw-r--r-- | builtin/ls-tree.c | 3 | ||||
-rw-r--r-- | builtin/merge-tree.c | 2 |
6 files changed, 11 insertions, 7 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c index 08b0ac48f3..d338d96fe9 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -115,7 +115,8 @@ static int update_some(const struct object_id *oid, struct strbuf *base, static int read_tree_some(struct tree *tree, const struct pathspec *pathspec) { - read_tree_recursive(tree, "", 0, 0, pathspec, update_some, NULL); + read_tree_recursive(the_repository, tree, "", 0, 0, + pathspec, update_some, NULL); /* update the index with the given tree's info * for all args, expanding wildcards, and exit diff --git a/builtin/grep.c b/builtin/grep.c index bad9c0a3d5..4748195ae1 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/log.c b/builtin/log.c index e8e51068bd..3e145fe502 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -641,8 +641,9 @@ int cmd_show(int argc, const char **argv, const char *prefix) diff_get_color_opt(&rev.diffopt, DIFF_COMMIT), name, diff_get_color_opt(&rev.diffopt, DIFF_RESET)); - read_tree_recursive((struct tree *)o, "", 0, 0, &match_all, - show_tree_object, rev.diffopt.file); + read_tree_recursive(the_repository, (struct tree *)o, "", + 0, 0, &match_all, show_tree_object, + rev.diffopt.file); rev.shown_one = 1; break; case OBJ_COMMIT: diff --git a/builtin/ls-files.c b/builtin/ls-files.c index c70a9c7158..7e0dcaa359 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -441,7 +441,7 @@ void overlay_tree_on_index(struct index_state *istate, PATHSPEC_PREFER_CWD, prefix, matchbuf); } else memset(&pathspec, 0, sizeof(pathspec)); - if (read_tree(tree, 1, &pathspec, istate)) + if (read_tree(the_repository, tree, 1, &pathspec, istate)) die("unable to read tree entries %s", tree_name); for (i = 0; i < istate->cache_nr; i++) { diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c index 7d581d6463..7cad3f24eb 100644 --- a/builtin/ls-tree.c +++ b/builtin/ls-tree.c @@ -185,5 +185,6 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix) tree = parse_tree_indirect(&oid); if (!tree) die("not a tree object"); - return !!read_tree_recursive(tree, "", 0, 0, &pathspec, show_tree, NULL); + return !!read_tree_recursive(the_repository, tree, "", 0, 0, + &pathspec, show_tree, NULL); } diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index 70f6fc9167..4984b7e12e 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) |