Skip to content

Commit 8bb3e4e

Browse files
authored
Merge pull request #292 from fandoghpaas/enhancement/enhance-ignore-logic
Enhance ignore logic
2 parents 769c75c + 1031a2c commit 8bb3e4e

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

fandogh_cli/workspace.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ def get_ignored_entries(self):
4949
ignore_file_path = os.path.join(self.path, ignore_file)
5050
if os.path.exists(ignore_file_path):
5151
with open(ignore_file_path, 'r') as file:
52-
entries = [line for line in file.readlines() if line.strip() and not line.startswith('#')]
52+
entries = [line.strip() for line in file.readlines() if line.strip() and not line.startswith('#')]
5353
entries = self.add_custom_ignore_folder_to_entries(entries, [".git/", ".git"])
5454
expand_entries = []
5555
for entry in entries:
56-
expand_entries.append(entry.strip() + os.sep + '*')
56+
if not str(entry.strip()).endswith(os.sep + '*') and not str(entry.strip()).endswith(os.sep):
57+
expand_entries.append(entry.strip() + os.sep + '*')
5758
entries = entries + expand_entries
5859
for index, entry in enumerate(entries):
5960
if entry.startswith("/"):
6061
entries[index] = entry[1:]
61-
6262
return entries
6363

6464
def tardir(self, path, tarh):
@@ -70,6 +70,8 @@ def tardir(self, path, tarh):
7070
if file != 'workspace.tar.gz':
7171

7272
file_path = os.path.join(os.path.relpath(root, path), file)
73+
if file_path.startswith('./'):
74+
file_path = file_path.replace('./', '', 1)
7375

7476
if file.lower() != "dockerfile" and any(
7577
fnmatch(file_path, ignore.strip()) for ignore in ignored_entries):

0 commit comments

Comments
 (0)