From 6fe58a69e39e6588527f6a67e59884053ac1bdb1 Mon Sep 17 00:00:00 2001 From: ulucs Date: Thu, 11 Apr 2024 15:35:44 +0200 Subject: [PATCH] bugfix(?): Write user-provided generated .gitignore content after the API-provided content (#232) * reorder API and user-provided .gitignore content * add changelog --- .changelog/_unreleased.toml | 6 ++++++ kraken-build/src/kraken/std/git/tasks/sync_task.py | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.changelog/_unreleased.toml b/.changelog/_unreleased.toml index 6c12d919..3e1c71dc 100644 --- a/.changelog/_unreleased.toml +++ b/.changelog/_unreleased.toml @@ -1,3 +1,9 @@ +[[entries]] +id = "251fc70d-a665-448a-9c07-42794342129a" +type = "improvement" +description = "Move generated .gitignore around so user-provided definitions can overwrite API-provided ones" +author = "uluc.sengil@helsing.ai" + [[entries]] id = "5a4c9349-429d-4594-805b-404ed45020c3" type = "improvement" diff --git a/kraken-build/src/kraken/std/git/tasks/sync_task.py b/kraken-build/src/kraken/std/git/tasks/sync_task.py index 5f577c05..2310de5a 100644 --- a/kraken-build/src/kraken/std/git/tasks/sync_task.py +++ b/kraken-build/src/kraken/std/git/tasks/sync_task.py @@ -53,11 +53,13 @@ def get_file_contents(self, file: Path) -> str: user1, user2 = user2, user1 # Replace the generated content. - generated = GitignoreFile.parse(self.generated_content.get()) + generated = GitignoreFile() if tokens := self.gitignore_io_tokens.get(): generated += GitignoreFile.parse( gitignore_io_fetch_cached(tokens, backfill=self.gitignore_io_allow_http_request_backfill.get()) ) + # User-provided generated content, allowing for overrides to API-generated content. + generated += GitignoreFile.parse(self.generated_content.get()) # Ensure there's at least one blank space between sections. if user1 and generated and (user1[-1] != "" and generated[0] != ""):