#19 #20
@@ -22,7 +22,7 @@ import (
 | 
				
			|||||||
	"go.unistack.org/micro/v3/logger"
 | 
						"go.unistack.org/micro/v3/logger"
 | 
				
			||||||
	"go.unistack.org/pkgdash/internal/configcli"
 | 
						"go.unistack.org/pkgdash/internal/configcli"
 | 
				
			||||||
	"go.unistack.org/pkgdash/internal/modules"
 | 
						"go.unistack.org/pkgdash/internal/modules"
 | 
				
			||||||
	gogit "go.unistack.org/pkgdash/internal/source/git"
 | 
						//gogit "go.unistack.org/pkgdash/internal/source/git"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var ErrPRNotExist = errors.New("pull request does not exist")
 | 
					var ErrPRNotExist = errors.New("pull request does not exist")
 | 
				
			||||||
@@ -104,7 +104,7 @@ func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// открытие гит репозитория с опцией обхода репозитория для нахождения .git
 | 
						// открытие гит репозитория с опцией обхода репозитория для нахождения .git
 | 
				
			||||||
	repo, err := gogit.PlainOpenWithOptions(".", &git.PlainOpenOptions{DetectDotGit: true})
 | 
						repo, err := git.PlainOpenWithOptions(".", &git.PlainOpenOptions{DetectDotGit: true})
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		g.logger.Fatal(ctx, fmt.Sprintf("failed to open repo: %v", err))
 | 
							g.logger.Fatal(ctx, fmt.Sprintf("failed to open repo: %v", err))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -276,7 +276,7 @@ func (g *Gitea) RequestUpdate(ctx context.Context, branch string, path string, m
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// открытие гит репозитория с опцией обхода репозитория для нахождения .git
 | 
						// открытие гит репозитория с опцией обхода репозитория для нахождения .git
 | 
				
			||||||
	repo, err := gogit.PlainOpenWithOptions(".", &git.PlainOpenOptions{DetectDotGit: true})
 | 
						repo, err := git.PlainOpenWithOptions(".", &git.PlainOpenOptions{DetectDotGit: true})
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		g.logger.Fatal(ctx, fmt.Sprintf("failed to open repo: %v", err))
 | 
							g.logger.Fatal(ctx, fmt.Sprintf("failed to open repo: %v", err))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -435,7 +435,7 @@ func (g *Gitea) GetPulls(ctx context.Context, url, owner, repo, password string)
 | 
				
			|||||||
	return pullsAll, nil
 | 
						return pullsAll, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (g *Gitea) checkout(w gogit.Worktree, ref *plumbing.Reference) error {
 | 
					func (g *Gitea) checkout(w *git.Worktree, ref *plumbing.Reference) error {
 | 
				
			||||||
	ctx := context.Background()
 | 
						ctx := context.Background()
 | 
				
			||||||
	g.logger.Debug(ctx, "checkout: "+ref.Name().Short())
 | 
						g.logger.Debug(ctx, "checkout: "+ref.Name().Short())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -451,7 +451,7 @@ func (g *Gitea) checkout(w gogit.Worktree, ref *plumbing.Reference) error {
 | 
				
			|||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (g Gitea) fetchCheckout(ctx context.Context, repo gogit.Repository, branch, path string, mod modules.Update) (gogit.Worktree, *plumbing.Reference, error) {
 | 
					func (g Gitea) fetchCheckout(ctx context.Context, repo *git.Repository, branch, path string, mod modules.Update) (*git.Worktree, *plumbing.Reference, error) {
 | 
				
			||||||
	// обновляем ветки
 | 
						// обновляем ветки
 | 
				
			||||||
	if err := repo.FetchContext(ctx, &git.FetchOptions{
 | 
						if err := repo.FetchContext(ctx, &git.FetchOptions{
 | 
				
			||||||
		Auth:  &httpauth.BasicAuth{Username: g.Username, Password: g.Password},
 | 
							Auth:  &httpauth.BasicAuth{Username: g.Username, Password: g.Password},
 | 
				
			||||||
@@ -469,7 +469,11 @@ func (g Gitea) fetchCheckout(ctx context.Context, repo gogit.Repository, branch,
 | 
				
			|||||||
		return nil, nil, err
 | 
							return nil, nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, ref := range branches {
 | 
						for {
 | 
				
			||||||
 | 
							ref, err := branches.Next()
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return nil, nil, err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		if ref.Name().Short() == branch {
 | 
							if ref.Name().Short() == branch {
 | 
				
			||||||
			//Получаем ссылку на нужную ветку
 | 
								//Получаем ссылку на нужную ветку
 | 
				
			||||||
			headRef = plumbing.NewHashReference(ref.Name(), ref.Hash())
 | 
								headRef = plumbing.NewHashReference(ref.Name(), ref.Hash())
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user