From 40ad64ddffd45bf075f44453ef9fc0b73d62f840 Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Mon, 10 Jun 2024 17:31:14 +0200 Subject: [PATCH] Ignore .osc directory --- lib/git.py | 6 ++++++ lib/git_exporter.py | 1 + 2 files changed, 7 insertions(+) diff --git a/lib/git.py b/lib/git.py index c92472d..d1636d2 100644 --- a/lib/git.py +++ b/lib/git.py @@ -183,6 +183,12 @@ class Git: def add(self, filename): self.git_run(["add", filename]) + def add_default_gitignore(self): + if not (self.path / ".gitignore").exists(): + with (self.path / ".gitignore").open("w") as f: + f.write(".osc\n") + self.add(".gitignore") + def add_default_lfs_gitattributes(self, force=False): if not (self.path / ".gitattributes").exists() or force: with (self.path / ".gitattributes").open("w") as f: diff --git a/lib/git_exporter.py b/lib/git_exporter.py index 36ebf73..ebbab73 100644 --- a/lib/git_exporter.py +++ b/lib/git_exporter.py @@ -150,6 +150,7 @@ class GitExporter: # create file if not existant self.git.add_default_lfs_gitattributes(force=False) + self.git.add_default_gitignore() to_download, to_delete = flat.commit.calc_delta(branch_state[flat.branch]) for file in to_delete: