mirror of
https://github.com/TagStudioDev/TagStudio.git
synced 2026-01-28 22:01:24 +00:00
fix: respect trailing slash patterns in glob (#1127)
This commit is contained in:
committed by
GitHub
parent
ea4b01ec08
commit
23323431b8
@@ -38,7 +38,7 @@ GLOBAL_IGNORE = [
|
||||
|
||||
|
||||
def ignore_to_glob(ignore_patterns: list[str]) -> list[str]:
|
||||
"""Convert .gitignore-like patterns to explicit glob syntax.
|
||||
"""Convert .gitignore-like patterns to Unix-like glob syntax.
|
||||
|
||||
Args:
|
||||
ignore_patterns (list[str]): The .gitignore-like patterns to convert.
|
||||
@@ -48,7 +48,7 @@ def ignore_to_glob(ignore_patterns: list[str]) -> list[str]:
|
||||
additional_patterns: list[str] = []
|
||||
root_patterns: list[str] = []
|
||||
|
||||
# Mimic implicit .gitignore syntax behavior for the SQLite GLOB function.
|
||||
# Expand .gitignore patterns to mimic the same behavior with unix-like glob patterns.
|
||||
for pattern in glob_patterns:
|
||||
# Temporarily remove any exclusion character before processing
|
||||
exclusion_char = ""
|
||||
@@ -62,9 +62,6 @@ def ignore_to_glob(ignore_patterns: list[str]) -> list[str]:
|
||||
gp = "**/" + gp
|
||||
additional_patterns.append(exclusion_char + gp)
|
||||
|
||||
gp = gp.removesuffix("/**").removesuffix("/*").removesuffix("/")
|
||||
additional_patterns.append(exclusion_char + gp)
|
||||
|
||||
gp = gp.removeprefix("**/").removeprefix("*/")
|
||||
additional_patterns.append(exclusion_char + gp)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user