fix: make test suite run on older git version (#8188)

Ref: forgejo/forgejo#8140, forgejo/forgejo#8144
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8188
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
This commit is contained in:
Gusted 2025-06-14 19:50:58 +02:00 committed by Earl Warren
parent 53d5e6d754
commit 90f8239448
7 changed files with 71 additions and 46 deletions

View file

@ -32,10 +32,15 @@ func TestPatchStatus(t *testing.T) {
user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
session := loginUser(t, user2.Name)
var objectFormat optional.Option[string]
if git.SupportHashSha256 {
objectFormat = optional.Some("sha256")
}
repo, _, f := tests.CreateDeclarativeRepoWithOptions(t, user2, tests.DeclarativeRepoOptions{
AutoInit: optional.Some(true),
EnabledUnits: optional.Some([]unit_model.Type{unit_model.TypeCode}),
ObjectFormat: optional.Some("sha256"),
ObjectFormat: objectFormat,
Files: optional.Some([]*files_service.ChangeRepoFile{
{
Operation: "create",