Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2013-07-14 12:35:33 +0400
committerJunio C Hamano <gitster@pobox.com>2013-07-15 21:56:06 +0400
commitb69bb3fc271911317c12fd6ecce6fe1e0301a2b3 (patch)
tree74147c602a11573d350e51fadf32ae81f31a4a89 /pathspec.c
parent6330a171996abbec7dac48788de851aea7d0a18f (diff)
parse_pathspec: support stripping submodule trailing slashes
This flag is equivalent to builtin/ls-files.c:strip_trailing_slashes() and is intended to replace that function when ls-files is converted to use 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.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/pathspec.c b/pathspec.c
index 06778fc756..1c07c23fe0 100644
--- a/pathspec.c
+++ b/pathspec.c
@@ -205,6 +205,15 @@ static unsigned prefix_pathspec(struct pathspec_item *item,
*raw = item->match = match;
item->original = elt;
item->len = strlen(item->match);
+
+ if ((flags & PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP) &&
+ (item->len >= 1 && item->match[item->len - 1] == '/') &&
+ (i = cache_name_pos(item->match, item->len - 1)) >= 0 &&
+ S_ISGITLINK(active_cache[i]->ce_mode)) {
+ item->len--;
+ match[item->len] = '\0';
+ }
+
if (limit_pathspec_to_literal())
item->nowildcard_len = item->len;
else