Skip to content

Commit afed59f

Browse files
authored
Fix GitIgnore (#2491)
`ignore()` builds paths with leading `./`, e.g., `./path/to`, while `load_recursive()` builds relative paths using `Path.relative_to()`, which produces paths without `./`, e.g., `path/to`. Fixes: #2485
1 parent 3b02bc4 commit afed59f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/dstack/_internal/utils/ignore.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ def __init__(
2020
self.load_recursive()
2121

2222
def load_ignore_file(self, path: str, ignore_file: Path):
23+
if path != "." and not path.startswith("./"):
24+
path = "./" + path
2325
if path not in self.ignore_globs:
2426
self.ignore_globs[path] = []
2527
with ignore_file.open("r") as f:

0 commit comments

Comments
 (0)