From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH v2 15/21] checkout: convert read_tree_some to take struct pathspec
Date: Fri, 11 Jan 2013 18:21:09 +0700 [thread overview]
Message-ID: <1357903275-16804-16-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1357903275-16804-1-git-send-email-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
builtin/checkout.c | 9 +++------
tree.c | 4 ++--
tree.h | 2 +-
3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/builtin/checkout.c b/builtin/checkout.c
index aa399d6..a7ddb35 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -82,12 +82,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
@@ -265,7 +262,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);
diff --git a/tree.c b/tree.c
index 62fed63..ff72f67 100644
--- a/tree.c
+++ b/tree.c
@@ -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;
@@ -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;
diff --git a/tree.h b/tree.h
index 69bcb5e..9dc90ba 100644
--- a/tree.h
+++ b/tree.h
@@ -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);
--
1.8.0.rc2.23.g1fb49df
next prev parent reply other threads:[~2013-01-11 11:22 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-11 11:20 [PATCH v2 00/21] nd/parse-pathspec reroll Nguyễn Thái Ngọc Duy
2013-01-11 11:20 ` [PATCH v2 01/21] pathspec: save the non-wildcard length part Nguyễn Thái Ngọc Duy
2013-01-11 11:20 ` [PATCH v2 02/21] Add parse_pathspec() that converts cmdline args to struct pathspec Nguyễn Thái Ngọc Duy
2013-01-11 11:20 ` [PATCH v2 03/21] Export parse_pathspec() and convert some get_pathspec() calls Nguyễn Thái Ngọc Duy
2013-01-11 17:56 ` Matt Kraai
2013-01-12 6:00 ` Duy Nguyen
2013-01-11 11:20 ` [PATCH v2 04/21] clean: convert to use parse_pathspec Nguyễn Thái Ngọc Duy
2013-01-11 11:20 ` [PATCH v2 05/21] commit: " Nguyễn Thái Ngọc Duy
2013-01-12 22:54 ` Martin von Zweigbergk
2013-01-11 11:21 ` [PATCH v2 06/21] status: " Nguyễn Thái Ngọc Duy
2013-01-11 11:21 ` [PATCH v2 07/21] rerere: " Nguyễn Thái Ngọc Duy
2013-01-11 11:21 ` [PATCH v2 08/21] checkout: " Nguyễn Thái Ngọc Duy
2013-01-11 11:21 ` [PATCH v2 09/21] rm: " Nguyễn Thái Ngọc Duy
2013-01-11 11:21 ` [PATCH v2 10/21] ls-files: " Nguyễn Thái Ngọc Duy
2013-01-11 11:21 ` [PATCH v2 11/21] archive: " Nguyễn Thái Ngọc Duy
2013-01-11 11:21 ` [PATCH v2 12/21] add: " Nguyễn Thái Ngọc Duy
2013-01-11 11:21 ` [PATCH v2 13/21] Convert read_cache_preload() to take struct pathspec Nguyễn Thái Ngọc Duy
2013-01-11 11:21 ` [PATCH v2 14/21] Convert unmerge_cache " Nguyễn Thái Ngọc Duy
2013-01-11 11:21 ` Nguyễn Thái Ngọc Duy [this message]
2013-01-11 11:21 ` [PATCH v2 16/21] Convert report_path_error " Nguyễn Thái Ngọc Duy
2013-01-11 11:21 ` [PATCH v2 17/21] Convert refresh_index " Nguyễn Thái Ngọc Duy
2013-01-11 14:19 ` Nguyen Thai Ngoc Duy
2013-01-11 11:21 ` [PATCH v2 18/21] Convert {read,fill}_directory " Nguyễn Thái Ngọc Duy
2013-01-11 11:21 ` [PATCH v2 19/21] Convert add_files_to_cache " Nguyễn Thái Ngọc Duy
2013-01-11 11:21 ` [PATCH v2 20/21] Convert more init_pathspec() to parse_pathspec() Nguyễn Thái Ngọc Duy
2013-01-11 11:21 ` [PATCH v2 21/21] Rename field "raw" to "_raw" in struct pathspec Nguyễn Thái Ngọc Duy
2013-01-11 14:26 ` [PATCH v2 22/21] Convert the last use of match_pathspec() and remove it Nguyễn Thái Ngọc Duy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1357903275-16804-16-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).