Only use SHA256 feature when git >= 2.42 (#28466)
And fix some comments
This commit is contained in:
parent
52046b934d
commit
9947af639c
4 changed files with 11 additions and 12 deletions
|
@ -63,7 +63,7 @@ func IsRepoURLAccessible(ctx context.Context, url string) bool {
|
|||
return err == nil
|
||||
}
|
||||
|
||||
// GetObjectFormatOfRepo returns the hash type of a repository at a given path
|
||||
// GetObjectFormatOfRepo returns the hash type of repository at a given path
|
||||
func GetObjectFormatOfRepo(ctx context.Context, repoPath string) (ObjectFormat, error) {
|
||||
var stdout, stderr strings.Builder
|
||||
|
||||
|
@ -96,7 +96,10 @@ func InitRepository(ctx context.Context, repoPath string, bare bool, objectForma
|
|||
return err
|
||||
}
|
||||
|
||||
cmd := NewCommand(ctx, "init", "--object-format").AddDynamicArguments(objectFormat.String())
|
||||
cmd := NewCommand(ctx, "init")
|
||||
if SupportHashSha256 {
|
||||
cmd.AddOptionValues("--object-format", objectFormat.String())
|
||||
}
|
||||
if bare {
|
||||
cmd.AddArguments("--bare")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue