From c08397e3aa46fd0f0da29dfe5b257839b9c5d1c8 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Thu, 11 May 2017 15:04:24 -0700 Subject: 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 Signed-off-by: Junio C Hamano --- builtin/add.c | 5 +++-- builtin/check-ignore.c | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'builtin') diff --git a/builtin/add.c b/builtin/add.c index ec58e3679..86770d6af 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -388,10 +388,11 @@ int cmd_add(int argc, const char **argv, const char *prefix) */ parse_pathspec(&pathspec, 0, PATHSPEC_PREFER_FULL | - PATHSPEC_SYMLINK_LEADING_PATH | - PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE, + PATHSPEC_SYMLINK_LEADING_PATH, prefix, argv); + die_path_inside_submodule(&the_index, &pathspec); + if (add_new_files) { int baselen; diff --git a/builtin/check-ignore.c b/builtin/check-ignore.c index 1d73d3ca3..91040a4b0 100644 --- a/builtin/check-ignore.c +++ b/builtin/check-ignore.c @@ -4,6 +4,7 @@ #include "quote.h" #include "pathspec.h" #include "parse-options.h" +#include "submodule.h" static int quiet, verbose, stdin_paths, show_non_matching, no_index; static const char * const check_ignore_usage[] = { @@ -87,10 +88,11 @@ static int check_ignore(struct dir_struct *dir, parse_pathspec(&pathspec, PATHSPEC_ALL_MAGIC & ~PATHSPEC_FROMTOP, PATHSPEC_SYMLINK_LEADING_PATH | - PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE | PATHSPEC_KEEP_ORDER, prefix, argv); + die_path_inside_submodule(&the_index, &pathspec); + /* * look for pathspecs matching entries in the index, since these * should not be ignored, in order to be consistent with -- cgit v1.2.1