Skip to content

A protected branch cannot be created from a normal branch when the protection rule includes specific file protections. #33265

Closed
@Flint01686

Description

@Flint01686

Description

I've encountered a non-critical but illogical issue that manifests as unexpected behavior. I have a rule for the customer/ prefix that protects the core folder (details are in the screenshots). When I try to create a branch with the customer/ prefix from the master branch (which has no protections), I receive an error. The error is shown in the screenshots, and the root cause can be seen in the server logs. It looks like this:
2025/01/14 13:54:42 .../hook_pre_receive.go:235:preReceiveBranch() [E] Unable to check file protection for commits from 0000000000000000000000000000000000000000 to 6ca0e381b177e3577f62ec9a03df8a00acb0b165 in <Repository 2:compname/reponame>: cannot find the start commit of 6ca0e381b177e3577f62ec9a03df8a00acb0b165
2025/01/14 13:54:42 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/internal/hook/pre-receive/compname/reponame for 127.0.0.1:0, 500 Internal Server Error in 52.7ms @ private/hook_pre_receive.go:105(private.HookPreReceive)

Gitea Version

1.22.6

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

изображение
изображение
изображение

Git Version

2.42.0.windows.2

Operating System

Windows 11

How are you running Gitea?

Use exe for win from official gitea site

Database

PostgreSQL

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions