Subject: [PATCH v2 21/21] Rename field "raw" to "_raw" in struct pathspec

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Fri, 11 Jan 2013 18:21:15 +0700

This patch is essentially no-op. It helps catching new use of this
field though. This field is introduced as an intermediate step for the
pathspec conversion and will be removed eventually. At this stage no
more access sites should be introduced.

Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>
---
 archive.c          |  2 +-
 builtin/add.c      | 20 ++++++++++----------
 builtin/checkout.c |  2 +-
 builtin/commit.c   |  2 +-
 builtin/ls-files.c |  8 ++++----
 builtin/ls-tree.c  |  2 +-
 builtin/rm.c       |  2 +-
 cache.h            |  2 +-
 dir.c              | 22 +++++++++++-----------
 revision.c         |  4 ++--
 setup.c            |  6 +++---
 tree-diff.c        |  8 ++++----
 12 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/archive.c b/archive.c
index 3caa31f..c52e525 100644
--- a/archive.c
+++ b/archive.c
@@ -229,7 +229,7 @@ static void parse_pathspec_arg(const char **pathspec,
 {
 	parse_pathspec(&ar_args->pathspec, PATHSPEC_FROMTOP, 0, "", pathspec);
 	if (ar_args->pathspec.nr) {
-		pathspec = ar_args->pathspec.raw;
+		pathspec = ar_args->pathspec._raw;
 		while (*pathspec) {
 			if (!path_exists(ar_args->tree, *pathspec))
 				die("path not found: %s", *pathspec);
diff --git a/builtin/add.c b/builtin/add.c
index 5d262eb..6b6a72e 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -165,7 +165,7 @@ static void refresh(int verbose, const struct pathspec *pathspec)
 		      pathspec, seen, _("Unstaged changes after refreshing the index:"));
 	for (i = 0; i < pathspec->nr; i++) {
 		if (!seen[i])
-			die(_("pathspec '%s' did not match any files"), pathspec->raw[i]);
+			die(_("pathspec '%s' did not match any files"), pathspec->_raw[i]);
 	}
         free(seen);
 }
@@ -387,7 +387,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 		return 0;
 	}
 	parse_pathspec(&pathspec, PATHSPEC_FROMTOP, 0, prefix, argv);
-	validate_pathspec(pathspec.raw, prefix);
+	validate_pathspec(pathspec._raw, prefix);
 
 	if (read_cache() < 0)
 		die(_("index file corrupt"));
@@ -406,7 +406,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 		/* This picks up the paths that are not tracked */
 		baselen = fill_directory(&dir, &pathspec);
 		if (pathspec.nr)
-			seen = prune_directory(&dir, pathspec.raw, baselen);
+			seen = prune_directory(&dir, pathspec._raw, baselen);
 	}
 
 	if (refresh_only) {
@@ -420,17 +420,17 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 
 		path_exclude_check_init(&check, &dir);
 		if (!seen)
-			seen = find_used_pathspec(pathspec.raw);
-		for (i = 0; pathspec.raw[i]; i++) {
-			if (!seen[i] && pathspec.raw[i][0]
-			    && !file_exists(pathspec.raw[i])) {
+			seen = find_used_pathspec(pathspec._raw);
+		for (i = 0; pathspec._raw[i]; i++) {
+			if (!seen[i] && pathspec._raw[i][0]
+			    && !file_exists(pathspec._raw[i])) {
 				if (ignore_missing) {
 					int dtype = DT_UNKNOWN;
-					if (path_excluded(&check, pathspec.raw[i], -1, &dtype))
-						dir_add_ignored(&dir, pathspec.raw[i], strlen(pathspec.raw[i]));
+					if (path_excluded(&check, pathspec._raw[i], -1, &dtype))
+						dir_add_ignored(&dir, pathspec._raw[i], strlen(pathspec._raw[i]));
 				} else
 					die(_("pathspec '%s' did not match any files"),
-					    pathspec.raw[i]);
+					    pathspec._raw[i]);
 			}
 		}
 		free(seen);
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 648768e..716a949 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -253,7 +253,7 @@ static int checkout_paths(const struct checkout_opts *opts,
 
 	if (opts->patch_mode)
 		return run_add_interactive(revision, "--patch=checkout",
-					   opts->pathspec.raw);
+					   opts->pathspec._raw);
 
 	lock_file = xcalloc(1, sizeof(struct lock_file));
 
diff --git a/builtin/commit.c b/builtin/commit.c
index d79613d..876916c 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -192,7 +192,7 @@ static int list_paths(struct string_list *list, const char *with_tree,
 	m = xcalloc(1, pattern->nr);
 
 	if (with_tree) {
-		char *max_prefix = common_prefix(pattern->raw);
+		char *max_prefix = common_prefix(pattern->_raw);
 		overlay_tree_on_cache(with_tree, max_prefix ? max_prefix : prefix);
 		free(max_prefix);
 	}
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index 79949de..e9caa42 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -367,11 +367,11 @@ int report_path_error(const char *ps_matched,
 		 * twice.  Do not barf on such a mistake.
 		 */
 		for (found_dup = other = 0;
-		     !found_dup && pathspec->raw[other];
+		     !found_dup && pathspec->_raw[other];
 		     other++) {
 			if (other == num || !ps_matched[other])
 				continue;
-			if (!strcmp(pathspec->raw[other], pathspec->raw[num]))
+			if (!strcmp(pathspec->_raw[other], pathspec->_raw[num]))
 				/*
 				 * Ok, we have a match already.
 				 */
@@ -380,7 +380,7 @@ int report_path_error(const char *ps_matched,
 		if (found_dup)
 			continue;
 
-		name = quote_path_relative(pathspec->raw[num], -1, &sb, prefix);
+		name = quote_path_relative(pathspec->_raw[num], -1, &sb, prefix);
 		error("pathspec '%s' did not match any file(s) known to git.",
 		      name);
 		errors++;
@@ -540,7 +540,7 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
 	strip_trailing_slash_from_submodules(&pathspec);
 
 	/* Find common prefix for all pathspec's */
-	max_prefix = common_prefix(pathspec.raw);
+	max_prefix = common_prefix(pathspec._raw);
 	max_prefix_len = max_prefix ? strlen(max_prefix) : 0;
 
 	/* Treat unmatching pathspec elements as errors */
diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c
index a78ba53..ebb587b 100644
--- a/builtin/ls-tree.c
+++ b/builtin/ls-tree.c
@@ -35,7 +35,7 @@ static int show_recursive(const char *base, int baselen, const char *pathname)
 	if (ls_options & LS_RECURSIVE)
 		return 1;
 
-	s = pathspec.raw;
+	s = pathspec._raw;
 	if (!s)
 		return 0;
 
diff --git a/builtin/rm.c b/builtin/rm.c
index b5edde8..d12311c 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -267,7 +267,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 	if (pathspec.nr) {
 		const char *match;
 		int seen_any = 0;
-		for (i = 0; (match = pathspec.raw[i]) != NULL ; i++) {
+		for (i = 0; (match = pathspec._raw[i]) != NULL ; i++) {
 			if (!seen[i]) {
 				if (!ignore_unmatch) {
 					die(_("pathspec '%s' did not match any files"),
diff --git a/cache.h b/cache.h
index 3e09a61..c5a408f 100644
--- a/cache.h
+++ b/cache.h
@@ -482,7 +482,7 @@ extern int ie_modified(const struct index_state *, struct cache_entry *, struct
 #define PATHSPEC_EMPTY_MATCH_ALL (1<<0) /* No args means match everything */
 
 struct pathspec {
-	const char **raw; /* get_pathspec() result, not freed by free_pathspec() */
+	const char **_raw; /* get_pathspec() result, not freed by free_pathspec() */
 	int nr;
 	unsigned int has_wildcard:1;
 	unsigned int recursive:1;
diff --git a/dir.c b/dir.c
index eb52913..aad180b 100644
--- a/dir.c
+++ b/dir.c
@@ -80,10 +80,10 @@ int fill_directory(struct dir_struct *dir, const struct pathspec *pathspec)
 	 * Calculate common prefix for the pathspec, and
 	 * use that to optimize the directory walk
 	 */
-	len = common_prefix_len(pathspec->raw);
+	len = common_prefix_len(pathspec->_raw);
 
 	/* Read the directory and prune it */
-	read_directory(dir, pathspec->nr ? pathspec->raw[0] : "", len, pathspec);
+	read_directory(dir, pathspec->nr ? pathspec->_raw[0] : "", len, pathspec);
 	return len;
 }
 
@@ -1218,7 +1218,7 @@ int read_directory(struct dir_struct *dir, const char *path, int len, const stru
 	if (has_symlink_leading_path(path, len))
 		return dir->nr;
 
-	simplify = create_simplify(pathspec ? pathspec->raw : NULL);
+	simplify = create_simplify(pathspec ? pathspec->_raw : NULL);
 	if (!len || treat_leading_path(dir, path, len, simplify))
 		read_directory_recursive(dir, path, len, 0, simplify);
 	free_simplify(simplify);
@@ -1417,7 +1417,7 @@ int init_pathspec(struct pathspec *pathspec, const char **paths)
 		return 0;
 	while (*p)
 		p++;
-	pathspec->raw = paths;
+	pathspec->_raw = paths;
 	pathspec->nr = p - paths;
 	if (!pathspec->nr)
 		return 0;
@@ -1444,7 +1444,7 @@ void strip_trailing_slash_from_submodules(struct pathspec *pathspec)
 {
 	int i;
 	for (i = 0; i < pathspec->nr; i++) {
-		const char *p = pathspec->raw[i];
+		const char *p = pathspec->_raw[i];
 		int len = strlen(p), pos;
 
 		if (len < 1 || p[len - 1] != '/')
@@ -1452,7 +1452,7 @@ void strip_trailing_slash_from_submodules(struct pathspec *pathspec)
 		pos = cache_name_pos(p, len - 1);
 		if (pos >= 0 && S_ISGITLINK(active_cache[pos]->ce_mode)) {
 			char *path = xstrndup(p, len - 1);
-			pathspec->raw[i] = path;
+			pathspec->_raw[i] = path;
 			pathspec->items[i].match = path;
 			pathspec->items[i].len = len - 1;
 			pathspec->items[i].nowildcard_len = simple_length(path);
@@ -1472,20 +1472,20 @@ void treat_gitlinks(struct pathspec *pathspec)
 			continue;
 
 		for (j = 0; j < pathspec->nr; j++) {
-			int len2 = strlen(pathspec->raw[j]);
-			if (len2 <= len || pathspec->raw[j][len] != '/' ||
-			    memcmp(ce->name, pathspec->raw[j], len))
+			int len2 = strlen(pathspec->_raw[j]);
+			if (len2 <= len || pathspec->_raw[j][len] != '/' ||
+			    memcmp(ce->name, pathspec->_raw[j], len))
 				continue;
 			if (len2 == len + 1) {
 				/* strip trailing slash */
 				char *path = xstrndup(ce->name, len);
-				pathspec->raw[j] = path;
+				pathspec->_raw[j] = path;
 				pathspec->items[j].match = path;
 				pathspec->items[j].len = len;
 				pathspec->items[j].nowildcard_len = simple_length(path);
 			} else
 				die (_("Path '%s' is in submodule '%.*s'"),
-				     pathspec->raw[j], len, ce->name);
+				     pathspec->_raw[j], len, ce->name);
 		}
 	}
 }
diff --git a/revision.c b/revision.c
index a044242..d89bb22 100644
--- a/revision.c
+++ b/revision.c
@@ -1885,12 +1885,12 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
 		revs->limited = 1;
 
 	if (revs->prune_data.nr) {
-		diff_tree_setup_paths(revs->prune_data.raw, &revs->pruning);
+		diff_tree_setup_paths(revs->prune_data._raw, &revs->pruning);
 		/* Can't prune commits with rename following: the paths change.. */
 		if (!DIFF_OPT_TST(&revs->diffopt, FOLLOW_RENAMES))
 			revs->prune = 1;
 		if (!revs->full_diff)
-			diff_tree_setup_paths(revs->prune_data.raw, &revs->diffopt);
+			diff_tree_setup_paths(revs->prune_data._raw, &revs->diffopt);
 	}
 	if (revs->combine_merges)
 		revs->ignore_merges = 0;
diff --git a/setup.c b/setup.c
index a26b6c0..1182a0a 100644
--- a/setup.c
+++ b/setup.c
@@ -293,7 +293,7 @@ void parse_pathspec(struct pathspec *pathspec,
 		raw[0] = prefix;
 		raw[1] = NULL;
 		pathspec->nr = 1;
-		pathspec->raw = raw;
+		pathspec->_raw = raw;
 		return;
 	}
 
@@ -303,7 +303,7 @@ void parse_pathspec(struct pathspec *pathspec,
 
 	pathspec->nr = n;
 	pathspec->items = item = xmalloc(sizeof(*item) * n);
-	pathspec->raw = argv;
+	pathspec->_raw = argv;
 	prefixlen = prefix ? strlen(prefix) : 0;
 
 	for (i = 0; i < n; i++) {
@@ -327,7 +327,7 @@ const char **get_pathspec(const char *prefix, const char **pathspec)
 {
 	struct pathspec ps;
 	parse_pathspec(&ps, PATHSPEC_FROMTOP, 0, prefix, pathspec);
-	return ps.raw;
+	return ps._raw;
 }
 
 /*
diff --git a/tree-diff.c b/tree-diff.c
index ba01563..09bddd1 100644
--- a/tree-diff.c
+++ b/tree-diff.c
@@ -207,7 +207,7 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co
 	DIFF_OPT_SET(&diff_opts, RECURSIVE);
 	DIFF_OPT_SET(&diff_opts, FIND_COPIES_HARDER);
 	diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
-	diff_opts.single_follow = opt->pathspec.raw[0];
+	diff_opts.single_follow = opt->pathspec._raw[0];
 	diff_opts.break_opt = opt->break_opt;
 	diff_opts.rename_score = opt->rename_score;
 	paths[0] = NULL;
@@ -228,15 +228,15 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co
 		 * the future!
 		 */
 		if ((p->status == 'R' || p->status == 'C') &&
-		    !strcmp(p->two->path, opt->pathspec.raw[0])) {
+		    !strcmp(p->two->path, opt->pathspec._raw[0])) {
 			/* Switch the file-pairs around */
 			q->queue[i] = choice;
 			choice = p;
 
 			/* Update the path we use from now on.. */
 			diff_tree_release_paths(opt);
-			opt->pathspec.raw[0] = xstrdup(p->one->path);
-			diff_tree_setup_paths(opt->pathspec.raw, opt);
+			opt->pathspec._raw[0] = xstrdup(p->one->path);
+			diff_tree_setup_paths(opt->pathspec._raw, opt);
 
 			/*
 			 * The caller expects us to return a set of vanilla
-- 
1.8.0.rc2.23.g1fb49df