path: root/builtin/checkout.c
diff options
authorNguyễn Thái Ngọc Duy <>2011-03-25 09:34:19 (GMT)
committerJunio C Hamano <>2011-03-25 16:20:33 (GMT)
commitf0096c06bcdeb7aa6ae8a749ddc9d6d4a2c381d1 (patch)
treeb5b28251c9e48186b9e6168cbfefe4ace0f57602 /builtin/checkout.c
parentffd31f661d5c5dddc091750ca86cfaa5d9d04b38 (diff)
Convert read_tree{,_recursive} to support struct pathspec
This patch changes behavior of the two functions. Previously it does prefix matching only. Now it can also do wildcard matching. All callers are updated. Some gain wildcard matching (archive, checkout), others reset pathspec_item.has_wildcard to retain old behavior (ls-files, ls-tree as they are plumbing). Signed-off-by: Nguyễn Thái Ngọc Duy <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/checkout.c')
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 757f9a0..f4d4db1 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -78,7 +78,10 @@ static int update_some(const unsigned char *sha1, const char *base, int baselen,
static int read_tree_some(struct tree *tree, const char **pathspec)
- read_tree_recursive(tree, "", 0, 0, pathspec, update_some, NULL);
+ struct pathspec ps;
+ init_pathspec(&ps, pathspec);
+ read_tree_recursive(tree, "", 0, 0, &ps, update_some, NULL);
+ free_pathspec(&ps);
/* update the index with the given tree's info
* for all args, expanding wildcards, and exit