A repository with no .gitignore gets one for its stack: from the proposal, or from its files before the first code commit #107
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happened
cmoriarty/scratchwas created by New Project with no.gitignore. Its first work run (PR #8 there, the one that wrote the whole codebase) committedbackend/app/__pycache__/*.pyc,backend/tests/__pycache__/*.pycandbackend/scratch_backend.egg-info/in its very first feature commit. Every run after that committed changes to them, until they were removed by hand (scratch874eba9).#105's exclude block keeps environments and caches out of a run's own commits, but it lives only in the run's clone. It isn't in the repository, so it doesn't help a person or CI working in a checkout. It also doesn't cover packaging metadata such as
*.egg-info/.Expected
.gitignoreadds one. It is built from Forgejo's.gitignoretemplates (the github/gitignore set, served at/api/v1/gitignore/templates) for the languages and tools the repository uses. A repository that already has a root.gitignoreis never touched..osf/proposal.jsonas template names (Python,Node, …). The.gitignoreis written from them and committed with the proposal, before any code exists..gitignore(a quick-fix or docs pipeline, or a stack the proposal didn't name), the.gitignoreis built from the manifests in the worktree:pyproject.toml→ Python,package.json→ Node,go.mod→ Go,Cargo.toml→ Rust, and so on.Adding nodes to the built-in pipelines runs into #102 for runs already in flight, so deploy when idle.
Related: #105, #100.
Shipped in
1d596b7, as the OpenSpec changegitignore-from-stack. It's archived in96cc8daand adds a requirement to therun-worktreespec..osf/proposal.jsonas.gitignoretemplate names, for example"stack": ["Python", "Node"]. A new step,script.gitignore.proposal, runs beforegit.commit.proposal. When the repository has no root.gitignore, it writes one from the forge's templates (the github/gitignore set Forgejo serves) for that stack and for any manifests already present. The proposal commit carries it, before any code exists.script.gitignore.featureruns beforegit.commit.featurein every pipeline that has one, quick-fix and docs included. If there's still no root.gitignore, it builds one from the manifests in the worktree:pyproject.toml→ Python,package.json→ Node,go.mod→ Go,Cargo.toml→ Rust, and so on..gitignoreis never changed: both steps are skipped with the reason "the repository has its own .gitignore". If the forge can't serve the templates, the step says so and the run carries on. Each step records what it did in.osf/gitignore.json.ForgejoClientwith no token sent an emptyAuthorization: tokenheader, which httpx refuses, so no tokenless request could be made. It now sends no header.Verified:
["Python"], and its commit carried the Python template.script.gitignore.featurewas skipped, and the feature commit left out the.pytest_cache,greet.egg-infoand__pycache__the tests made.cmoriarty/scratchnow having its own.gitignore: a run showed both steps skipped as not needed, and its proposal named its stack as["Python"].