fix: Allow SHA-256 in PR commit URLs (#10309)

Closes #9129. I decided to try myself in contributing to Forgejo after having found this bug mentioned on Fedi.

I have also added a basic test for this behaviour, but this means that this PR adds a SHA-256 repo to the fixture set, so it can be reused in other tests.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10309
Reviewed-by: Lucas <sclu1034@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Nikita Karamov <me@kytta.dev>
Co-committed-by: Nikita Karamov <me@kytta.dev>
This commit is contained in:
Nikita Karamov 2025-12-16 00:45:00 +01:00 committed by Gusted
parent 0398fa85e1
commit a22e5f86c6
46 changed files with 260 additions and 32 deletions

View file

@ -69,3 +69,25 @@
is_deleted: false
deleted_by_id: 0
deleted_unix: 0
- id: 17
repo_id: 66
name: 'master'
commit_id: '7b299a0be8450b8304e30f1f7feea2383903e02bb4b7600d37eb2bb6e934daba'
commit_message: 'Initial commit'
commit_time: 1764879244
pusher_id: 2
is_deleted: false
deleted_by_id: 0
deleted_unix: 0
- id: 18
repo_id: 66
name: 'branch2'
commit_id: '004581b3bb63754502364664021404490ee747ce58e98d27c046f2e46f5f2f55'
commit_message: 'PR'
commit_time: 1764879438
pusher_id: 2
is_deleted: false
deleted_by_id: 0
deleted_unix: 0

View file

@ -372,3 +372,19 @@
created_unix: 1707270422
updated_unix: 1707270422
is_locked: false
- id: 24
repo_id: 66
index: 1
poster_id: 2
original_author_id: 0
name: PR
content: ''
milestone_id: 0
priority: 0
is_closed: false
is_pull: true
num_comments: 0
created_unix: 1764879458
updated_unix: 1764879458
is_locked: false

View file

@ -25,3 +25,6 @@
-
group_id: 51
max_index: 1
- group_id: 66
max_index: 1

View file

@ -119,3 +119,16 @@
index: 1
head_repo_id: 61
base_repo_id: 61
- id: 12
type: 0 # gitea pull request
status: 2 # mergeable
issue_id: 24
index: 1
head_repo_id: 66
base_repo_id: 66
head_branch: branch2
base_branch: master
merge_base: 004581b3bb63754502364664021404490ee747ce58e98d27c046f2e46f5f2f55
has_merged: false

View file

@ -802,3 +802,34 @@
type: 10
config: "{}"
created_unix: 946684810
-
id: 116
repo_id: 66
type: 1
config: "{}"
created_unix: 1764879302
- id: 117
repo_id: 66
type: 2
config: "{\"EnableTimetracker\":true,\"AllowOnlyContributorsToTrackTime\":true,\"EnableDependencies\":true}"
created_unix: 1764879302
- id: 118
repo_id: 66
type: 3
config: "{\"IgnoreWhitespaceConflicts\":false,\"AllowMerge\":true,\"AllowRebase\":true,\"AllowRebaseMerge\":true,\"AllowSquash\":true}"
created_unix: 1764879302
- id: 119
repo_id: 66
type: 4
config: "{}"
created_unix: 1764879302
- id: 120
repo_id: 66
type: 5
config: "{}"
created_unix: 1764879302

View file

@ -1684,3 +1684,34 @@
is_fsck_enabled: true
close_issues_via_commit_in_any_branch: false
topics: '[]'
-
id: 66
owner_id: 2
owner_name: user2
lower_name: repo256
name: repo256
default_branch: master
num_watches: 0
num_stars: 0
num_forks: 0
num_milestones: 0
num_closed_milestones: 0
num_projects: 0
num_closed_projects: 0
is_private: false
is_empty: false
is_archived: false
is_mirror: false
status: 0
is_fork: false
fork_id: 0
is_template: false
template_id: 0
size: 24586
is_fsck_enabled: true
close_issues_via_commit_in_any_branch: false
created_unix: 1764879302
updated_unix: 1764879302
topics: '[]'
object_format_name: 'sha256'

View file

@ -70,7 +70,7 @@
num_followers: 2
num_following: 1
num_stars: 2
num_repos: 18
num_repos: 19
num_teams: 0
num_members: 0
visibility: 0