dir: make the DO_MATCH_SUBMODULE code reusable for a non-submodule case

The specific checks done in match_pathspec_item for the DO_MATCH_SUBMODULE case are useful for other cases which have nothing to do with submodules. Rename this constant; a subsequent commit will make use of this change. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Sep 17, 2019 at 09:34 UTC a3d89d8f7681c61c7fe04a0c01c7310a375f3d0e
1 file changed +3 -3
dir.c
+3 -3
@@ -273,7 +273,7 @@ static int do_read_blob(const struct object_id *oid, struct oid_stat *oid_stat,
273
274 #define DO_MATCH_EXCLUDE (1<<0)
275 #define DO_MATCH_DIRECTORY (1<<1)
276 -#define DO_MATCH_SUBMODULE (1<<2)
276 +#define DO_MATCH_LEADING_PATHSPEC (1<<2)
277
278 /*
279 * Does 'match' match the given name?
@@ -354,7 +354,7 @@ static int match_pathspec_item(const struct index_state *istate,
354 return MATCHED_FNMATCH;
355
356 /* Perform checks to see if "name" is a super set of the pathspec */
357 - if (flags & DO_MATCH_SUBMODULE) {
357 + if (flags & DO_MATCH_LEADING_PATHSPEC) {
358 /* name is a literal prefix of the pathspec */
359 int offset = name[namelen-1] == '/' ? 1 : 0;
360 if ((namelen < matchlen) &&
@@ -498,7 +498,7 @@ int submodule_path_match(const struct index_state *istate,
498 strlen(submodule_name),
499 0, seen,
500 DO_MATCH_DIRECTORY |
501 - DO_MATCH_SUBMODULE);
501 + DO_MATCH_LEADING_PATHSPEC);
502 return matched;
503 }
504