Skip to content

Commit

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

Technically older versions of Git would support this flag as well, but
per #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>
  • Loading branch information
jolheiser authored Jan 25, 2024
1 parent 3084c99 commit 76bbad4
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 76bbad4

Please sign in to comment.