Skip to content

Commit e269b34

Browse files
committed
ignore: only skip first leading slash
For compatibility with git, only skip the first leading slash in an ignore file. That is: `/a.txt` indicates to ignore a file named `a.txt` at the root. However `//b.txt` does not indicate that a file named `b.txt` at the root should be ignored.
1 parent e6e6b60 commit e269b34

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/attr_file.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,8 @@ int git_attr_fnmatch__parse(
604604
if (*scan == '/') {
605605
spec->flags = spec->flags | GIT_ATTR_FNMATCH_FULLPATH;
606606
slash_count++;
607-
if (pattern == scan)
607+
608+
if (slash_count == 1 && pattern == scan)
608609
pattern++;
609610
}
610611
/* remember if we see an unescaped wildcard in pattern */

0 commit comments

Comments
 (0)