Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
libxcb-xinerama0 \
libxkbcommon-x11-0 \
libyaml-dev \
ripgrep \
x11-utils
- name: Execute pytest
Expand Down
2 changes: 1 addition & 1 deletion src/tagstudio/core/library/refresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ def __get_dir_list(self, library_dir: Path, ignore_patterns: list[str]) -> list[
),
cwd=library_dir,
capture_output=True,
text=True,
shell=True,
encoding="UTF-8",
)
compiled_ignore_path.unlink()

Expand Down
23 changes: 23 additions & 0 deletions tests/macros/test_refresh_dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the GPL-3.0 License.
# Created for TagStudio: https://github.com/CyanVoxel/TagStudio

import shutil
from pathlib import Path
from tempfile import TemporaryDirectory

Expand Down Expand Up @@ -29,3 +30,25 @@ def test_refresh_new_files(library: Library, exclude_mode: bool):
# Test if the single file was added
list(registry.refresh_dir(library_dir, force_internal_tools=True))
assert registry.files_not_in_library == [Path("FOO.MD")]


@pytest.mark.parametrize("library", [TemporaryDirectory()], indirect=True)
def test_refresh_multi_byte_filenames_ripgrep(library: Library):
assert shutil.which("rg") is not None

library_dir = unwrap(library.library_dir)
# Given
registry = RefreshTracker(library=library)
library.included_files.clear()
(library_dir / ".TagStudio").mkdir()
(library_dir / "こんにちは.txt").touch()
(library_dir / "em–dash.txt").touch()
(library_dir / "apostrophe’.txt").touch()
(library_dir / "umlaute äöü.txt").touch()

# Test if all files were added with their correct names and without exceptions
list(registry.refresh_dir(library_dir))
assert Path("こんにちは.txt") in registry.files_not_in_library
assert Path("em–dash.txt") in registry.files_not_in_library
assert Path("apostrophe’.txt") in registry.files_not_in_library
assert Path("umlaute äöü.txt") in registry.files_not_in_library