fixup deps

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2023-10-02 22:53:49 +03:00
parent b9bd602b46
commit f2f6fcbb0d

View File

@ -283,11 +283,16 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[
logger.Fatalf(ctx, "failed to reset repo branch: %v", err) logger.Fatalf(ctx, "failed to reset repo branch: %v", err)
} }
newbranch := fmt.Sprintf("pkgdash/go_modules/%s-%s", path, mod.Version) newref := plumbing.NewHashReference(plumbing.ReferenceName(fmt.Sprintf("refs/heads/pkgdash/go_modules/%s-%s", path, mod.Version)), headRef.Hash())
if err = repo.Storer.SetReference(newref); err != nil {
logger.Fatalf(ctx, "failed to create repo branch: %v", err)
}
logger.Infof(ctx, "checkout ref %s to %s", headRef) logger.Infof(ctx, "checkout ref %s to %s", headRef)
if err = wtree.Checkout(&git.CheckoutOptions{ if err = wtree.Checkout(&git.CheckoutOptions{
Hash: headRef.Hash(), Hash: headRef.Hash(),
Branch: newbranch, Branch: newref.Name(),
Create: true, Create: true,
Force: true, Force: true,
}); err != nil { }); err != nil {
@ -326,7 +331,7 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[
} }
logger.Infof(ctx, "worktree commit") logger.Infof(ctx, "worktree commit")
commit, err := wtree.Commit(wTitle.String(), &git.CommitOptions{ _, err = wtree.Commit(wTitle.String(), &git.CommitOptions{
Parents: []plumbing.Hash{headRef.Hash()}, Parents: []plumbing.Hash{headRef.Hash()},
Author: &object.Signature{ Author: &object.Signature{
Name: "gitea-actions", Name: "gitea-actions",
@ -338,12 +343,6 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[
logger.Fatalf(ctx, "failed to commit: %v", err) logger.Fatalf(ctx, "failed to commit: %v", err)
} }
newref := plumbing.NewHashReference(plumbing.ReferenceName(fmt.Sprintf("refs/heads/pkgdash/go_modules/%s-%s", path, mod.Version)), commit)
if err = repo.Storer.SetReference(newref); err != nil {
logger.Fatalf(ctx, "failed to create repo branch: %v", err)
}
refspec := gitconfig.RefSpec(fmt.Sprintf("+" + newref.Name().String() + ":" + newref.Name().String())) refspec := gitconfig.RefSpec(fmt.Sprintf("+" + newref.Name().String() + ":" + newref.Name().String()))
logger.Infof(ctx, "try to push %s", refspec) logger.Infof(ctx, "try to push %s", refspec)