Merge pull request 'Ignore .osc directory' (#28) from adamm/git-importer:gitingore into use_git_for_sha256

Reviewed-on: #28
Reviewed-by: Dirk Mueller <dirkmueller@noreply@src.opensuse.org>
This commit is contained in:
Dirk Mueller 2024-06-10 18:13:33 +02:00
commit c44cb17e5d
2 changed files with 7 additions and 0 deletions

View File

@ -182,6 +182,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:

View File

@ -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: