--- title: "ADR 0026: Gitea default branch is fetched when the event has none" --- * Status: accepted * Code: [`pkg/provider/gitea/gitea.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/provider/gitea/gitea.go) (`GetCommitInfo`, `GetTektonDir`) ## Context Incoming webhook events are built without a webhook payload ([`pkg/adapter/incoming.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/adapter/incoming.go)), so `SHA` and `DefaultBranch` can both be empty. `GetTektonDir` resolves the tree from the SHA, or from `DefaultBranch` when provenance is `default_branch`; an empty revision would reach the SDK with an empty path segment. ## Decision `GetCommitInfo` calls `GetRepo` when `DefaultBranch` is empty and fails if the API reports none. `GetTektonDir` refuses an empty revision with an error naming provenance, SHA and default branch. `GetTektonDir` also stores the provenance on the provider so `GetFileInsideRepo` resolves repository-local task references from the same branch. ## Consequences * Events from payload-carrying webhooks skip the extra `GetRepo` call. * `GetCommitInfo` must run before `GetTektonDir` for incoming events.