From 46a20c8b600cc01880ab4721f1931074e6f8eaaa Mon Sep 17 00:00:00 2001 From: daviddoji Date: Wed, 28 Feb 2024 19:45:34 +0100 Subject: [PATCH] Write-tree ignore .ugit files --- ugit/base.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ugit/base.py b/ugit/base.py index a858ad0..0209e44 100644 --- a/ugit/base.py +++ b/ugit/base.py @@ -7,8 +7,14 @@ def write_tree(directory="."): with Path.iterdir(directory) as it: for entry in it: full = f"{directory}/{entry.name}" + if is_ignored(full): + continue if entry.is_file(follow_symlinks=False): # TODO write the file to object store print(full) elif entry.is_dir(follow_symlinks=False): write_tree(full) + + +def is_ignored(path): + return ".ugit" in path.split("/")