Skip to content

Commit

Permalink
Check for sha256 support to use --object-format flag (go-gitea#28928)
Browse files Browse the repository at this point in the history
This should fix go-gitea#28927

Technically older versions of Git would support this flag as well, but
per go-gitea#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 <[email protected]>
  • Loading branch information
jolheiser authored and henrygoodman committed Jan 31, 2024
1 parent 21c57f1 commit 25476bf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/git/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 25476bf

Please sign in to comment.