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 {
logger.Fatalf(ctx, "failed to open repo: %v", err)
}
headRef, err := repo.Head()
if err != nil {
logger.Fatalf(ctx, "failed to get repo head: %v", err)
}
wtree, err := repo.Worktree()
if err != nil {
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()
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())
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{}); err != nil {
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{
Branch: plumbing.NewBranchReferenceName(envBaseBranch),
Hash: headRef.Hash(),
Create: false,
Force: true,
}); err != nil {