Merge branch 'nd/literal-pathspecs'
Fixes a regression on 'master' since v1.8.4. * nd/literal-pathspecs: pathspec: stop --*-pathspecs impact on internal parse_pathspec() uses
This commit is contained in:
commit
c6f1b920ac
@ -409,7 +409,9 @@ static struct origin *find_origin(struct scoreboard *sb,
|
|||||||
paths[0] = origin->path;
|
paths[0] = origin->path;
|
||||||
paths[1] = NULL;
|
paths[1] = NULL;
|
||||||
|
|
||||||
parse_pathspec(&diff_opts.pathspec, PATHSPEC_ALL_MAGIC, 0, "", paths);
|
parse_pathspec(&diff_opts.pathspec,
|
||||||
|
PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
|
||||||
|
PATHSPEC_LITERAL_PATH, "", paths);
|
||||||
diff_setup_done(&diff_opts);
|
diff_setup_done(&diff_opts);
|
||||||
|
|
||||||
if (is_null_sha1(origin->commit->object.sha1))
|
if (is_null_sha1(origin->commit->object.sha1))
|
||||||
|
@ -128,7 +128,11 @@ static unsigned prefix_pathspec(struct pathspec_item *item,
|
|||||||
die(_("global 'literal' pathspec setting is incompatible "
|
die(_("global 'literal' pathspec setting is incompatible "
|
||||||
"with all other global pathspec settings"));
|
"with all other global pathspec settings"));
|
||||||
|
|
||||||
if (elt[0] != ':' || literal_global) {
|
if (flags & PATHSPEC_LITERAL_PATH)
|
||||||
|
global_magic = 0;
|
||||||
|
|
||||||
|
if (elt[0] != ':' || literal_global ||
|
||||||
|
(flags & PATHSPEC_LITERAL_PATH)) {
|
||||||
; /* nothing to do */
|
; /* nothing to do */
|
||||||
} else if (elt[1] == '(') {
|
} else if (elt[1] == '(') {
|
||||||
/* longhand */
|
/* longhand */
|
||||||
@ -405,6 +409,9 @@ void parse_pathspec(struct pathspec *pathspec,
|
|||||||
item[i].magic = prefix_pathspec(item + i, &short_magic,
|
item[i].magic = prefix_pathspec(item + i, &short_magic,
|
||||||
argv + i, flags,
|
argv + i, flags,
|
||||||
prefix, prefixlen, entry);
|
prefix, prefixlen, entry);
|
||||||
|
if ((flags & PATHSPEC_LITERAL_PATH) &&
|
||||||
|
!(magic_mask & PATHSPEC_LITERAL))
|
||||||
|
item[i].magic |= PATHSPEC_LITERAL;
|
||||||
if (item[i].magic & magic_mask)
|
if (item[i].magic & magic_mask)
|
||||||
unsupported_magic(entry,
|
unsupported_magic(entry,
|
||||||
item[i].magic & magic_mask,
|
item[i].magic & magic_mask,
|
||||||
|
@ -58,6 +58,13 @@ struct pathspec {
|
|||||||
#define PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE (1<<5)
|
#define PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE (1<<5)
|
||||||
#define PATHSPEC_PREFIX_ORIGIN (1<<6)
|
#define PATHSPEC_PREFIX_ORIGIN (1<<6)
|
||||||
#define PATHSPEC_KEEP_ORDER (1<<7)
|
#define PATHSPEC_KEEP_ORDER (1<<7)
|
||||||
|
/*
|
||||||
|
* For the callers that just need pure paths from somewhere else, not
|
||||||
|
* from command line. Global --*-pathspecs options are ignored. No
|
||||||
|
* magic is parsed in each pathspec either. If PATHSPEC_LITERAL is
|
||||||
|
* allowed, then it will automatically set for every pathspec.
|
||||||
|
*/
|
||||||
|
#define PATHSPEC_LITERAL_PATH (1<<8)
|
||||||
|
|
||||||
extern void parse_pathspec(struct pathspec *pathspec,
|
extern void parse_pathspec(struct pathspec *pathspec,
|
||||||
unsigned magic_mask,
|
unsigned magic_mask,
|
||||||
|
@ -1372,8 +1372,8 @@ static void prepare_show_merge(struct rev_info *revs)
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
free_pathspec(&revs->prune_data);
|
free_pathspec(&revs->prune_data);
|
||||||
parse_pathspec(&revs->prune_data, PATHSPEC_ALL_MAGIC,
|
parse_pathspec(&revs->prune_data, PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
|
||||||
PATHSPEC_PREFER_FULL, "", prune);
|
PATHSPEC_PREFER_FULL | PATHSPEC_LITERAL_PATH, "", prune);
|
||||||
revs->limited = 1;
|
revs->limited = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +108,13 @@ test_expect_success 'no-glob environment variable works' '
|
|||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'blame takes global pathspec flags' '
|
||||||
|
git --literal-pathspecs blame -- foo &&
|
||||||
|
git --icase-pathspecs blame -- foo &&
|
||||||
|
git --glob-pathspecs blame -- foo &&
|
||||||
|
git --noglob-pathspecs blame -- foo
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'setup xxx/bar' '
|
test_expect_success 'setup xxx/bar' '
|
||||||
mkdir xxx &&
|
mkdir xxx &&
|
||||||
test_commit xxx xxx/bar
|
test_commit xxx xxx/bar
|
||||||
|
@ -254,7 +254,9 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co
|
|||||||
path[0] = p->one->path;
|
path[0] = p->one->path;
|
||||||
path[1] = NULL;
|
path[1] = NULL;
|
||||||
free_pathspec(&opt->pathspec);
|
free_pathspec(&opt->pathspec);
|
||||||
parse_pathspec(&opt->pathspec, PATHSPEC_ALL_MAGIC, 0, "", path);
|
parse_pathspec(&opt->pathspec,
|
||||||
|
PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
|
||||||
|
PATHSPEC_LITERAL_PATH, "", path);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The caller expects us to return a set of vanilla
|
* The caller expects us to return a set of vanilla
|
||||||
|
Loading…
x
Reference in New Issue
Block a user