kill limit_pathspec_to_literal() as it's only used by parse_pathspec()

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Jul 14, 2013 at 15:36 UTC 341003e715c9a7c0332d3f8f08c2f3696a057565
3 files changed +6 -12
dir.c
-8
@@ -1473,14 +1473,6 @@ int remove_path(const char *name)
1473 return 0;
1474 }
1475
1476 -int limit_pathspec_to_literal(void)
1477 -{
1478 - static int flag = -1;
1479 - if (flag < 0)
1480 - flag = git_env_bool(GIT_LITERAL_PATHSPECS_ENVIRONMENT, 0);
1481 - return flag;
1482 -}
1483 -
1476 /*
1477 * Frees memory within dir which was allocated for exclude lists and
1478 * the exclude_stack. Does not free dir itself.
pathspec.c
+6 -2
@@ -91,11 +91,15 @@ static unsigned prefix_pathspec(struct pathspec_item *item,
91 const char *prefix, int prefixlen,
92 const char *elt)
93 {
94 + static int literal_global = -1;
95 unsigned magic = 0, short_magic = 0;
96 const char *copyfrom = elt, *long_magic_end = NULL;
97 char *match;
98 int i, pathspec_prefix = -1;
99
100 + if (literal_global < 0)
101 + literal_global = git_env_bool(GIT_LITERAL_PATHSPECS_ENVIRONMENT, 0);
102 +
103 if (elt[0] != ':') {
104 ; /* nothing to do */
105 } else if (elt[1] == '(') {
@@ -184,7 +188,7 @@ static unsigned prefix_pathspec(struct pathspec_item *item,
188 if (flags & PATHSPEC_PREFIX_ORIGIN) {
189 struct strbuf sb = STRBUF_INIT;
190 const char *start = elt;
187 - if (prefixlen && !limit_pathspec_to_literal()) {
191 + if (prefixlen && !literal_global) {
192 /* Preserve the actual prefix length of each pattern */
193 if (long_magic_end) {
194 strbuf_add(&sb, start, long_magic_end - start);
@@ -232,7 +236,7 @@ static unsigned prefix_pathspec(struct pathspec_item *item,
236 elt, ce_len, ce->name);
237 }
238
235 - if (limit_pathspec_to_literal())
239 + if (literal_global)
240 item->nowildcard_len = item->len;
241 else {
242 item->nowildcard_len = simple_length(item->match);
pathspec.h
-2
@@ -61,8 +61,6 @@ extern void parse_pathspec(struct pathspec *pathspec,
61 extern void copy_pathspec(struct pathspec *dst, const struct pathspec *src);
62 extern void free_pathspec(struct pathspec *);
63
64 -extern int limit_pathspec_to_literal(void);
65 -
64 extern char *find_pathspecs_matching_against_index(const struct pathspec *pathspec);
65 extern void add_pathspec_matches_against_index(const struct pathspec *pathspec, char *seen);
66 extern const char *check_path_for_gitlink(const char *path);