1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-01 17:38:33 +00:00

fix(ui): clarify repo init instruction for sha256 (#7394)

- When the repository is initalized with a different objectformat than sha1, ensure that the empty repository instructions reflects that the `git init` command also needs to be initialized with that objectformat.
- Resolves https://codeberg.org/codeberg/community/issues/1837
- Added integration test.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7394
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
This commit is contained in:
Gusted 2025-03-30 18:08:05 +00:00 committed by 0ko
parent 86039a89fc
commit 5275fbd4ea
3 changed files with 68 additions and 9 deletions

View file

@ -355,6 +355,7 @@ type DeclarativeRepoOptions struct {
WikiBranch optional.Option[string]
AutoInit optional.Option[bool]
IsTemplate optional.Option[bool]
ObjectFormat optional.Option[string]
}
func CreateDeclarativeRepoWithOptions(t *testing.T, owner *user_model.User, opts DeclarativeRepoOptions) (*repo_model.Repository, string, func()) {
@ -378,14 +379,15 @@ func CreateDeclarativeRepoWithOptions(t *testing.T, owner *user_model.User, opts
// Create the repository
repo, err := repo_service.CreateRepository(db.DefaultContext, owner, owner, repo_service.CreateRepoOptions{
Name: repoName,
Description: "Temporary Repo",
AutoInit: autoInit,
Gitignores: "",
License: "WTFPL",
Readme: "Default",
DefaultBranch: "main",
IsTemplate: opts.IsTemplate.Value(),
Name: repoName,
Description: "Temporary Repo",
AutoInit: autoInit,
Gitignores: "",
License: "WTFPL",
Readme: "Default",
DefaultBranch: "main",
IsTemplate: opts.IsTemplate.Value(),
ObjectFormatName: opts.ObjectFormat.Value(),
})
require.NoError(t, err)
assert.NotEmpty(t, repo)