@@ -316,8 +316,8 @@ int write_archive_entries(struct archiver_args *args,
git_attr_set_direction(GIT_ATTR_INDEX);
}
- err = read_tree_recursive(args->repo, args->tree, "",
- 0, 0, &args->pathspec,
+ err = read_tree_recursive(args->repo, args->tree,
+ 0, &args->pathspec,
queue_or_write_archive_entry,
&context);
if (err == READ_TREE_RECURSIVE)
@@ -405,8 +405,8 @@ static int path_exists(struct archiver_args *args, const char *path)
ctx.args = args;
parse_pathspec(&ctx.pathspec, 0, 0, "", paths);
ctx.pathspec.recursive = 1;
- ret = read_tree_recursive(args->repo, args->tree, "",
- 0, 0, &ctx.pathspec,
+ ret = read_tree_recursive(args->repo, args->tree,
+ 0, &ctx.pathspec,
reject_entry, &ctx);
clear_pathspec(&ctx.pathspec);
return ret != 0;
@@ -155,7 +155,7 @@ 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(the_repository, tree, "", 0, 0,
+ read_tree_recursive(the_repository, tree, 0,
pathspec, update_some, NULL);
/* update the index with the given tree's info
@@ -681,8 +681,8 @@ 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(the_repository, (struct tree *)o, "",
- 0, 0, &match_all, show_tree_object,
+ read_tree_recursive(the_repository, (struct tree *)o,
+ 0, &match_all, show_tree_object,
rev.diffopt.file);
rev.shown_one = 1;
break;
@@ -523,7 +523,7 @@ void overlay_tree_on_index(struct index_state *istate,
if (!fn)
fn = read_one_entry_quick;
- err = read_tree_recursive(the_repository, tree, "", 0, 1, &pathspec, fn, istate);
+ err = read_tree_recursive(the_repository, tree, 1, &pathspec, fn, istate);
if (err)
die("unable to read tree entries %s", tree_name);
@@ -185,6 +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(the_repository, tree, "", 0, 0,
+ return !!read_tree_recursive(the_repository, tree, 0,
&pathspec, show_tree, NULL);
}
@@ -473,7 +473,7 @@ static void get_files_dirs(struct merge_options *opt, struct tree *tree)
{
struct pathspec match_all;
memset(&match_all, 0, sizeof(match_all));
- read_tree_recursive(opt->repo, tree, "", 0, 0,
+ read_tree_recursive(opt->repo, tree, 0,
&match_all, save_files_dirs, opt);
}
@@ -83,14 +83,12 @@ static int read_tree_1(struct repository *r,
int read_tree_recursive(struct repository *r,
struct tree *tree,
- const char *base, int baselen,
int stage, const struct pathspec *pathspec,
read_tree_fn_t fn, void *context)
{
struct strbuf sb = STRBUF_INIT;
int ret;
- strbuf_add(&sb, base, baselen);
ret = read_tree_1(r, tree, &sb, stage, pathspec, fn, context);
strbuf_release(&sb);
return ret;
@@ -35,7 +35,6 @@ typedef int (*read_tree_fn_t)(const struct object_id *, struct strbuf *, const c
int read_tree_recursive(struct repository *r,
struct tree *tree,
- const char *base, int baselen,
int stage, const struct pathspec *pathspec,
read_tree_fn_t fn, void *context);
#endif /* TREE_H */
Every caller of the read_tree_recursive() function hardcoded a starting point of "" in the tree. So let's simply remove that parameter. The last function to call read_tree_recursive() with a non-"" path was read_tree_recursive() itself, but that was changed in ffd31f661d5 (Reimplement read_tree_recursive() using tree_entry_interesting(), 2011-03-25). As it turns out (Murphy's law and all) we're just about to gain a new in-tree user that would need this parameter[1]. Let's remove it anyway as the common case is going to be to not supply it, A later commit will bring back this functionality in different form. 1. https://lore.kernel.org/git/xmqqft106sok.fsf@gitster.g/ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- archive.c | 8 ++++---- builtin/checkout.c | 2 +- builtin/log.c | 4 ++-- builtin/ls-files.c | 2 +- builtin/ls-tree.c | 2 +- merge-recursive.c | 2 +- tree.c | 2 -- tree.h | 1 - 8 files changed, 10 insertions(+), 13 deletions(-)