fixup deps

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2023-10-02 02:04:45 +03:00
parent 10e17e6b99
commit 79e4051c74

View File

@ -210,10 +210,12 @@ func giteaPullRequest(ctx context.Context, cfg *Config, mods map[string]modules.
if err != nil { if err != nil {
logger.Fatalf(ctx, "failed to open repo: %v", err) logger.Fatalf(ctx, "failed to open repo: %v", err)
} }
headRef, err := repo.Head() headRef, err := repo.Head()
if err != nil { if err != nil {
logger.Fatalf(ctx, "failed to get repo head: %v", err) logger.Fatalf(ctx, "failed to get repo head: %v", err)
} }
wtree, err := repo.Worktree() wtree, err := repo.Worktree()
if err != nil { if err != nil {
logger.Fatalf(ctx, "failed to get worktree: %v", err) logger.Fatalf(ctx, "failed to get worktree: %v", err)
@ -223,20 +225,21 @@ func giteaPullRequest(ctx context.Context, cfg *Config, mods map[string]modules.
wTitle.Reset() wTitle.Reset()
wBody.Reset() wBody.Reset()
fmt.Printf("%s from %s to %s\n", path, mod.Module.Version, mod.Version) fmt.Printf("update %s from %s to %s\n", 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()) 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 { if err = repo.Storer.SetReference(newref); err != nil {
logger.Fatalf(ctx, "failed to create repo branch: %v", err) logger.Fatalf(ctx, "failed to create repo branch: %v", err)
} }
logger.Infof(ctx, "reset worktree")
if err = wtree.Reset(&git.ResetOptions{}); err != nil { if err = wtree.Reset(&git.ResetOptions{}); err != nil {
logger.Fatalf(ctx, "failed to reset repo branch: %v", err) logger.Fatalf(ctx, "failed to reset repo branch: %v", err)
} }
logger.Infof(ctx, "checkout branch %s", envBaseBranch) logger.Infof(ctx, "checkout ref %s", headRef)
if err = wtree.Checkout(&git.CheckoutOptions{ if err = wtree.Checkout(&git.CheckoutOptions{
Branch: plumbing.NewBranchReferenceName(envBaseBranch), Hash: headRef.Hash(),
Create: false, Create: false,
Force: true, Force: true,
}); err != nil { }); err != nil {