diff --git a/modules/git/repo.go b/modules/git/repo.go index c3de2eb0a..db99d285a 100644 --- a/modules/git/repo.go +++ b/modules/git/repo.go @@ -101,7 +101,9 @@ func InitRepository(ctx context.Context, repoPath string, bare bool, objectForma if !IsValidObjectFormat(objectFormatName) { return fmt.Errorf("invalid object format: %s", objectFormatName) } - cmd.AddOptionValues("--object-format", objectFormatName) + if SupportHashSha256 { + cmd.AddOptionValues("--object-format", objectFormatName) + } if bare { cmd.AddArguments("--bare")