summaryrefslogtreecommitdiff
path: root/pathspec.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2013-07-14 15:36:05 +0700
committerJunio C Hamano <gitster@pobox.com>2013-07-15 10:56:09 -0700
commit341003e715c9a7c0332d3f8f08c2f3696a057565 (patch)
tree89b8f9144e6ff986f09ae39a04b91f1a1ce877de /pathspec.c
parent233c3e6c59945650e5919893a4f090824f06e889 (diff)
downloadgit-341003e715c9a7c0332d3f8f08c2f3696a057565.tar.gz
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>
Diffstat (limited to 'pathspec.c')
-rw-r--r--pathspec.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pathspec.c b/pathspec.c
index 82ede57206..b2e3a8778c 100644
--- a/pathspec.c
+++ b/pathspec.c
@@ -91,11 +91,15 @@ static unsigned prefix_pathspec(struct pathspec_item *item,
const char *prefix, int prefixlen,
const char *elt)
{
+ static int literal_global = -1;
unsigned magic = 0, short_magic = 0;
const char *copyfrom = elt, *long_magic_end = NULL;
char *match;
int i, pathspec_prefix = -1;
+ if (literal_global < 0)
+ literal_global = git_env_bool(GIT_LITERAL_PATHSPECS_ENVIRONMENT, 0);
+
if (elt[0] != ':') {
; /* nothing to do */
} else if (elt[1] == '(') {
@@ -184,7 +188,7 @@ static unsigned prefix_pathspec(struct pathspec_item *item,
if (flags & PATHSPEC_PREFIX_ORIGIN) {
struct strbuf sb = STRBUF_INIT;
const char *start = elt;
- if (prefixlen && !limit_pathspec_to_literal()) {
+ if (prefixlen && !literal_global) {
/* Preserve the actual prefix length of each pattern */
if (long_magic_end) {
strbuf_add(&sb, start, long_magic_end - start);
@@ -232,7 +236,7 @@ static unsigned prefix_pathspec(struct pathspec_item *item,
elt, ce_len, ce->name);
}
- if (limit_pathspec_to_literal())
+ if (literal_global)
item->nowildcard_len = item->len;
else {
item->nowildcard_len = simple_length(item->match);