Skip to content

Commit 76bbad4

Browse files
authored
Check for sha256 support to use --object-format flag (#28928)
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>
1 parent 3084c99 commit 76bbad4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

modules/git/repo.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ func InitRepository(ctx context.Context, repoPath string, bare bool, objectForma
101101
if !IsValidObjectFormat(objectFormatName) {
102102
return fmt.Errorf("invalid object format: %s", objectFormatName)
103103
}
104-
cmd.AddOptionValues("--object-format", objectFormatName)
104+
if SupportHashSha256 {
105+
cmd.AddOptionValues("--object-format", objectFormatName)
106+
}
105107

106108
if bare {
107109
cmd.AddArguments("--bare")

0 commit comments

Comments
 (0)