Skip to content

Commit

Permalink
checkout: convert read_tree_some to take struct pathspec
Browse files Browse the repository at this point in the history
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Nguyễn Thái Ngọc Duy authored and Junio C Hamano committed Jul 15, 2013
1 parent 5ab0651 commit 18e4f40
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
9 changes: 3 additions & 6 deletions builtin/checkout.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,9 @@ static int update_some(const unsigned char *sha1, const char *base, int baselen,
return 0;
}

static int read_tree_some(struct tree *tree, const char **pathspec)
static int read_tree_some(struct tree *tree, const struct pathspec *pathspec)
{
struct pathspec ps;
init_pathspec(&ps, pathspec);
read_tree_recursive(tree, "", 0, 0, &ps, update_some, NULL);
free_pathspec(&ps);
read_tree_recursive(tree, "", 0, 0, pathspec, update_some, NULL);

/* update the index with the given tree's info
* for all args, expanding wildcards, and exit
Expand Down Expand Up @@ -266,7 +263,7 @@ static int checkout_paths(const struct checkout_opts *opts,
return error(_("corrupt index file"));

if (opts->source_tree)
read_tree_some(opts->source_tree, opts->pathspec.raw);
read_tree_some(opts->source_tree, &opts->pathspec);

ps_matched = xcalloc(1, opts->pathspec.nr);

Expand Down
4 changes: 2 additions & 2 deletions tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static int read_one_entry_quick(const unsigned char *sha1, const char *base, int
}

static int read_tree_1(struct tree *tree, struct strbuf *base,
int stage, struct pathspec *pathspec,
int stage, const struct pathspec *pathspec,
read_tree_fn_t fn, void *context)
{
struct tree_desc desc;
Expand Down Expand Up @@ -116,7 +116,7 @@ static int read_tree_1(struct tree *tree, struct strbuf *base,

int read_tree_recursive(struct tree *tree,
const char *base, int baselen,
int stage, struct pathspec *pathspec,
int stage, const struct pathspec *pathspec,
read_tree_fn_t fn, void *context)
{
struct strbuf sb = STRBUF_INIT;
Expand Down
2 changes: 1 addition & 1 deletion tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ typedef int (*read_tree_fn_t)(const unsigned char *, const char *, int, const ch

extern int read_tree_recursive(struct tree *tree,
const char *base, int baselen,
int stage, struct pathspec *pathspec,
int stage, const struct pathspec *pathspec,
read_tree_fn_t fn, void *context);

extern int read_tree(struct tree *tree, int stage, struct pathspec *pathspec);
Expand Down

0 comments on commit 18e4f40

Please sign in to comment.