From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 21/21] Convert more init_pathspec() to parse_pathspec()
Date: Sun, 6 Jan 2013 13:21:08 +0700 [thread overview]
Message-ID: <1357453268-12543-22-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1357453268-12543-1-git-send-email-pclouds@gmail.com>
init_pathspec() was introduced to work with the result from
get_pathspec(). init_pathspec() will be removed eventually after
parse_pathspec() takes over, so that there is only place that
initializes struct pathspec.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
archive.c | 2 +-
builtin/log.c | 2 +-
builtin/ls-files.c | 10 ++++------
diff-lib.c | 2 +-
merge-recursive.c | 2 +-
5 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/archive.c b/archive.c
index 530badb..3caa31f 100644
--- a/archive.c
+++ b/archive.c
@@ -218,7 +218,7 @@ static int path_exists(struct tree *tree, const char *path)
struct pathspec pathspec;
int ret;
- init_pathspec(&pathspec, paths);
+ parse_pathspec(&pathspec, 0, 0, "", paths);
ret = read_tree_recursive(tree, "", 0, 0, &pathspec, reject_entry, NULL);
free_pathspec(&pathspec);
return ret != 0;
diff --git a/builtin/log.c b/builtin/log.c
index e7b7db1..495ae77 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -455,7 +455,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
init_grep_defaults();
git_config(git_log_config, NULL);
- init_pathspec(&match_all, NULL);
+ memset(&match_all, 0, sizeof(match_all));
init_revisions(&rev, prefix);
rev.diff = 1;
rev.always_show_header = 1;
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index 7bb637b..79949de 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -318,13 +318,11 @@ void overlay_tree_on_cache(const char *tree_name, const char *prefix)
}
if (prefix) {
- static const char *(matchbuf[2]);
- matchbuf[0] = prefix;
- matchbuf[1] = NULL;
- init_pathspec(&pathspec, matchbuf);
- pathspec.items[0].nowildcard_len = pathspec.items[0].len;
+ static const char *(matchbuf[1]);
+ matchbuf[0] = NULL;
+ parse_pathspec(&pathspec, 0, 0, prefix, matchbuf);
} else
- init_pathspec(&pathspec, NULL);
+ memset(&pathspec, 0, sizeof(pathspec));
if (read_tree(tree, 1, &pathspec))
die("unable to read tree entries %s", tree_name);
diff --git a/diff-lib.c b/diff-lib.c
index f35de0f..9c07f6a 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -500,7 +500,7 @@ int do_diff_cache(const unsigned char *tree_sha1, struct diff_options *opt)
struct rev_info revs;
init_revisions(&revs, NULL);
- init_pathspec(&revs.prune_data, opt->pathspec.raw);
+ revs.prune_data = opt->pathspec;
revs.diffopt = *opt;
if (diff_cache(&revs, tree_sha1, NULL, 1))
diff --git a/merge-recursive.c b/merge-recursive.c
index d882060..cd95bdb 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -297,7 +297,7 @@ static int get_files_dirs(struct merge_options *o, struct tree *tree)
{
int n;
struct pathspec match_all;
- init_pathspec(&match_all, NULL);
+ memset(&match_all, 0, sizeof(match_all));
if (read_tree_recursive(tree, "", 0, 0, &match_all, save_files_dirs, o))
return 0;
n = o->current_file_set.nr + o->current_directory_set.nr;
--
1.8.0.rc2.23.g1fb49df
next prev parent reply other threads:[~2013-01-06 6:23 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-06 6:20 [PATCH 00/21] "struct pathspec" conversion Nguyễn Thái Ngọc Duy
2013-01-06 6:20 ` [PATCH 01/21] pathspec: save the non-wildcard length part Nguyễn Thái Ngọc Duy
2013-01-06 6:20 ` [PATCH 02/21] Add parse_pathspec() that converts cmdline args to struct pathspec Nguyễn Thái Ngọc Duy
2013-01-10 23:26 ` Martin von Zweigbergk
2013-01-11 2:33 ` Duy Nguyen
2013-01-06 6:20 ` [PATCH 03/21] pathspec: make sure the prefix part is wildcard-clean Nguyễn Thái Ngọc Duy
2013-01-07 1:10 ` Duy Nguyen
2013-01-06 6:20 ` [PATCH 04/21] Export parse_pathspec() and convert some get_pathspec() calls Nguyễn Thái Ngọc Duy
2013-01-06 6:20 ` [PATCH 05/21] clean: convert to use parse_pathspec Nguyễn Thái Ngọc Duy
2013-01-06 6:20 ` [PATCH 06/21] commit: " Nguyễn Thái Ngọc Duy
2013-01-06 6:20 ` [PATCH 07/21] status: " Nguyễn Thái Ngọc Duy
2013-01-06 6:20 ` [PATCH 08/21] rerere: " Nguyễn Thái Ngọc Duy
2013-01-06 6:20 ` [PATCH 09/21] checkout: " Nguyễn Thái Ngọc Duy
2013-01-06 6:20 ` [PATCH 10/21] rm: " Nguyễn Thái Ngọc Duy
2013-01-06 6:20 ` [PATCH 11/21] ls-files: " Nguyễn Thái Ngọc Duy
2013-01-06 6:20 ` [PATCH 12/21] archive: " Nguyễn Thái Ngọc Duy
2013-01-06 6:21 ` [PATCH 13/21] add: " Nguyễn Thái Ngọc Duy
2013-01-06 6:21 ` [PATCH 14/21] Convert read_cache_preload() to take struct pathspec Nguyễn Thái Ngọc Duy
2013-01-06 6:21 ` [PATCH 15/21] Convert unmerge_cache " Nguyễn Thái Ngọc Duy
2013-01-06 6:21 ` [PATCH 16/21] checkout: convert read_tree_some " Nguyễn Thái Ngọc Duy
2013-01-06 6:21 ` [PATCH 17/21] Convert report_path_error " Nguyễn Thái Ngọc Duy
2013-01-06 6:21 ` [PATCH 18/21] Convert refresh_index " Nguyễn Thái Ngọc Duy
2013-01-06 6:21 ` [PATCH 19/21] Convert {read,fill}_directory " Nguyễn Thái Ngọc Duy
2013-01-06 6:21 ` [PATCH 20/21] Convert add_files_to_cache " Nguyễn Thái Ngọc Duy
2013-01-06 6:21 ` Nguyễn Thái Ngọc Duy [this message]
2013-01-06 21:45 ` [PATCH 00/21] "struct pathspec" conversion Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1357453268-12543-22-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).