From 4cecf83b0362c14f544698153e0cc79338c792b6 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Mon, 2 Oct 2023 22:31:23 +0300 Subject: [PATCH] fixup deps Signed-off-by: Vasiliy Tolstov --- cmd/pkgdashcli/main.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cmd/pkgdashcli/main.go b/cmd/pkgdashcli/main.go index 12cb901..6d99eaa 100644 --- a/cmd/pkgdashcli/main.go +++ b/cmd/pkgdashcli/main.go @@ -268,11 +268,6 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[ wBody.Reset() logger.Infof(ctx, "update %s from %s to %s", path, mod.Module.Version, 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, "reset worktree") if err = wtree.Reset(&git.ResetOptions{Mode: git.HardReset}); err != nil { @@ -320,7 +315,7 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[ } logger.Infof(ctx, "worktree commit") - _, err = wtree.Commit(wTitle.String(), &git.CommitOptions{ + commit, err := wtree.Commit(wTitle.String(), &git.CommitOptions{ Author: &object.Signature{ Name: "gitea-actions", Email: "info@unistack.org", @@ -331,6 +326,12 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[ 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())) logger.Infof(ctx, "try to push %s", refspec)