Skip to content

Commit 017f804

Browse files
committed
Merge branch 'nd/negative-pathspec'
* nd/negative-pathspec: tree-walk.c: ignore trailing slash on submodule in tree_entry_interesting()
2 parents 523f0a2 + 74b4f7f commit 017f804

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

t/t4010-diff-pathspec.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,21 @@ test_expect_success 'diff-tree -r with wildcard' '
110110
test_cmp expected result
111111
'
112112

113+
test_expect_success 'setup submodules' '
114+
test_tick &&
115+
git init submod &&
116+
( cd submod && test_commit first; ) &&
117+
git add submod &&
118+
git commit -m first &&
119+
( cd submod && test_commit second; ) &&
120+
git add submod &&
121+
git commit -m second
122+
'
123+
124+
test_expect_success 'diff-tree ignores trailing slash on submodule path' '
125+
git diff --name-only HEAD^ HEAD submod >expect &&
126+
git diff --name-only HEAD^ HEAD submod/ >actual &&
127+
test_cmp expect actual
128+
'
129+
113130
test_done

tree-walk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ static int match_entry(const struct pathspec_item *item,
543543
if (matchlen > pathlen) {
544544
if (match[pathlen] != '/')
545545
return 0;
546-
if (!S_ISDIR(entry->mode))
546+
if (!S_ISDIR(entry->mode) && !S_ISGITLINK(entry->mode))
547547
return 0;
548548
}
549549

0 commit comments

Comments
 (0)