summaryrefslogtreecommitdiff
path: root/pathspec.c
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2017-05-11 15:04:24 -0700
committerJunio C Hamano <gitster@pobox.com>2017-05-12 14:23:46 +0900
commitc08397e3aa46fd0f0da29dfe5b257839b9c5d1c8 (patch)
tree7b86e30521606f9953e249db7dd3792d3eb4fe62 /pathspec.c
parentbdab972153a73815e04e9699406433e409ed28ab (diff)
downloadgit-c08397e3aa46fd0f0da29dfe5b257839b9c5d1c8.tar.gz
pathspec: remove PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE flag
Since (ae8d08242 pathspec: pass directory indicator to match_pathspec_item()) the path matching logic has been able to cope with submodules without needing to strip off a trailing slash if a path refers to a submodule. Since the stripping the trailing slash is no longer necessary, remove the PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE flag. In addition, factor out the logic which dies if a path decends into a submodule so that it can still be used as a check after a pathspec struct has been initialized. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pathspec.c')
-rw-r--r--pathspec.c29
1 files changed, 0 insertions, 29 deletions
diff --git a/pathspec.c b/pathspec.c
index 9b7634c5aa..e424312786 100644
--- a/pathspec.c
+++ b/pathspec.c
@@ -398,32 +398,6 @@ static void strip_submodule_slash_cheap(struct pathspec_item *item)
}
}
-static void strip_submodule_slash_expensive(struct pathspec_item *item)
-{
- int i;
-
- for (i = 0; i < active_nr; i++) {
- struct cache_entry *ce = active_cache[i];
- int ce_len = ce_namelen(ce);
-
- if (!S_ISGITLINK(ce->ce_mode))
- continue;
-
- if (item->len <= ce_len || item->match[ce_len] != '/' ||
- memcmp(ce->name, item->match, ce_len))
- continue;
-
- if (item->len == ce_len + 1) {
- /* strip trailing slash */
- item->len--;
- item->match[item->len] = '\0';
- } else {
- die(_("Pathspec '%s' is in submodule '%.*s'"),
- item->original, ce_len, ce->name);
- }
- }
-}
-
/*
* Perform the initialization of a pathspec_item based on a pathspec element.
*/
@@ -499,9 +473,6 @@ static void init_pathspec_item(struct pathspec_item *item, unsigned flags,
if (flags & PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP)
strip_submodule_slash_cheap(item);
- if (flags & PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE)
- strip_submodule_slash_expensive(item);
-
if (magic & PATHSPEC_LITERAL) {
item->nowildcard_len = item->len;
} else {