diff options
author | John Olheiser <john.olheiser@gmail.com> | 2024-01-25 19:04:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-25 19:04:50 +0100 |
commit | 76bbad4e746af977fea66c719d38048869de36c4 (patch) | |
tree | 774501d2cd83913e2623ac05fc596f894026bc1b /modules/git | |
parent | fix: update enable_prune even if mirror_interval is not provided (#28905) (diff) | |
download | forgejo-76bbad4e746af977fea66c719d38048869de36c4.tar.xz forgejo-76bbad4e746af977fea66c719d38048869de36c4.zip |
Check for sha256 support to use --object-format flag (#28928)
This should fix https://github.com/go-gitea/gitea/issues/28927
Technically older versions of Git would support this flag as well, but
per https://github.com/go-gitea/gitea/pull/28466 that's the version
where using it (object-format=sha256) left "experimental" state.
`sha1` is (currently) the default, so older clients should be unaffected
in either case.
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Diffstat (limited to 'modules/git')
-rw-r--r-- | modules/git/repo.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/git/repo.go b/modules/git/repo.go index c3de2eb0ad..db99d285a8 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") |