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

Closed
opened 2025-11-02 10:59:19 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @Flint01686 on GitHub (Jan 14, 2025).

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

Originally created by @Flint01686 on GitHub (Jan 14, 2025). ### 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 ![изображение](https://github.com/user-attachments/assets/14050637-e9d9-4101-bbc3-ad2ef5275325) ![изображение](https://github.com/user-attachments/assets/c588bb6c-119d-4e7d-9318-308afd7cfd09) ![изображение](https://github.com/user-attachments/assets/30fd7a1d-5b31-462a-8796-dcef6dc73c8b) ### 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
GiteaMirror added the type/bug label 2025-11-02 10:59:19 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#13988