Compare commits
2 Commits
73eb89d397
...
46a20c8b60
Author | SHA1 | Date |
---|---|---|
David Doblas Jiménez | 46a20c8b60 | |
David Doblas Jiménez | fdfcfdbdad |
|
@ -0,0 +1,8 @@
|
|||
- write-tree: Ignore .ugit files
|
||||
|
||||
If we run `ugit write-tree`, we will see that it also prints the content of the
|
||||
.ugit directory. This directory isn't part of the user's files, so let's ignore
|
||||
it.
|
||||
|
||||
Actually, I created a separate `is_ignored()` function. This way if we have any
|
||||
other files we want to ignore later we have one place to change.
|
|
@ -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("/")
|
||||
|
|
Loading…
Reference in New Issue