Skip to content

Commit

Permalink
bugfix(?): Write user-provided generated .gitignore content after the…
Browse files Browse the repository at this point in the history
… API-provided content (#232)

* reorder API and user-provided .gitignore content

* add changelog
  • Loading branch information
ulucs authored Apr 11, 2024
1 parent f2a6b41 commit 6fe58a6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changelog/_unreleased.toml
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]"

[[entries]]
id = "5a4c9349-429d-4594-805b-404ed45020c3"
type = "improvement"
Expand Down
4 changes: 3 additions & 1 deletion kraken-build/src/kraken/std/git/tasks/sync_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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] != ""):
Expand Down

0 comments on commit 6fe58a6

Please sign in to comment.