Drop AutoInit from Org repository create

Pushing the first branch is sufficient to set a default, and the
`README.md` (and/or LICENSE) can better be pushed later on so commit
author and templates be configured.

This was already done for User in an earlier patch release.

Signed-off-by: Hidde Beydals <hello@hidde.co>
pull/1307/head
Hidde Beydals 4 years ago
parent 2fe3934491
commit 43388ec67b

@ -280,11 +280,8 @@ func (b *GitProviderBootstrapper) reconcileOrgRepository(ctx context.Context) (g
} }
// go-git-providers has at present some issues with the idempotency // go-git-providers has at present some issues with the idempotency
// of the available Reconcile methods, and setting e.g. the default // of the available Reconcile methods, and setting e.g. the default
// branch correctly. Resort to Create with AutoInit until this has // branch correctly. Resort to Create until this has been resolved.
// been resolved. repo, err = b.provider.OrgRepositories().Create(ctx, repoRef, repoInfo)
repo, err = b.provider.OrgRepositories().Create(ctx, repoRef, repoInfo, &gitprovider.RepositoryCreateOptions{
AutoInit: gitprovider.BoolVar(true),
})
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to create new Git repository %q: %w", repoRef.String(), err) return nil, fmt.Errorf("failed to create new Git repository %q: %w", repoRef.String(), err)
} }
@ -348,6 +345,7 @@ func (b *GitProviderBootstrapper) reconcileUserRepository(ctx context.Context) (
repoRef := newUserRepositoryRef(userRef, repoName) repoRef := newUserRepositoryRef(userRef, repoName)
repoInfo := newRepositoryInfo(b.description, b.defaultBranch, b.visibility) repoInfo := newRepositoryInfo(b.description, b.defaultBranch, b.visibility)
// Reconcile the user repository
repo, err := b.provider.UserRepositories().Get(ctx, repoRef) repo, err := b.provider.UserRepositories().Get(ctx, repoRef)
if err != nil { if err != nil {
if !errors.Is(err, gitprovider.ErrNotFound) { if !errors.Is(err, gitprovider.ErrNotFound) {
@ -355,9 +353,8 @@ func (b *GitProviderBootstrapper) reconcileUserRepository(ctx context.Context) (
} }
// go-git-providers has at present some issues with the idempotency // go-git-providers has at present some issues with the idempotency
// of the available Reconcile methods, and setting e.g. the default // of the available Reconcile methods, and setting e.g. the default
// branch correctly. Resort to Create with AutoInit until this has // branch correctly. Resort to Create until this has been resolved.
// been resolved. repo, err = b.provider.UserRepositories().Create(ctx, repoRef, repoInfo)
repo, err = b.provider.UserRepositories().Create(ctx, repoRef, repoInfo, &gitprovider.RepositoryCreateOptions{})
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to create new Git repository %q: %w", repoRef.String(), err) return nil, fmt.Errorf("failed to create new Git repository %q: %w", repoRef.String(), err)
} }

Loading…
Cancel
Save