fixup deps

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2023-10-02 23:52:27 +03:00
parent f2f6fcbb0d
commit 4944012292
1 changed files with 18 additions and 11 deletions

View File

@ -71,6 +71,10 @@ func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
if err = logger.DefaultLogger.Init(logger.WithCallerSkipCount(3)); err != nil {
logger.Errorf(ctx, "logger init error: %v", err)
}
cfg := &Config{}
if err = config.Load(ctx,
@ -283,20 +287,14 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[
logger.Fatalf(ctx, "failed to reset repo branch: %v", err)
}
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", headRef)
if err = wtree.Checkout(&git.CheckoutOptions{
Hash: headRef.Hash(),
Branch: newref.Name(),
Branch: plumbing.NewBranchReferenceName(fmt.Sprintf("pkgdash/go_modules/%s-%s", path, mod.Version)),
Create: true,
Force: true,
}); err != nil {
logger.Fatalf(ctx, "failed to get checkout tree: %v", err)
logger.Fatalf(ctx, "failed to checkout tree: %v", err)
}
epath, err := exec.LookPath("go")
@ -343,8 +341,17 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[
logger.Fatalf(ctx, "failed to commit: %v", err)
}
refspec := gitconfig.RefSpec(fmt.Sprintf("+" + newref.Name().String() + ":" + newref.Name().String()))
logger.Infof(ctx, "try to push %s", refspec)
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)
}
*/
refspec := gitconfig.RefSpec(fmt.Sprintf("+refs/heads/pkgdash/go_modules/%s-%s:refs/heads/pkgdash/go_modules/%s-%s", path, mod.Version, path, mod.Version))
logger.Infof(ctx, "try to push refspec %s", refspec)
if err = repo.PushContext(ctx, &git.PushOptions{
RefSpecs: []gitconfig.RefSpec{refspec},