#19 #20
@@ -22,7 +22,7 @@ import (
 | 
			
		||||
	"go.unistack.org/micro/v3/logger"
 | 
			
		||||
	"go.unistack.org/pkgdash/internal/configcli"
 | 
			
		||||
	"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")
 | 
			
		||||
@@ -104,7 +104,7 @@ func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// открытие гит репозитория с опцией обхода репозитория для нахождения .git
 | 
			
		||||
	repo, err := gogit.PlainOpenWithOptions(".", &git.PlainOpenOptions{DetectDotGit: true})
 | 
			
		||||
	repo, err := git.PlainOpenWithOptions(".", &git.PlainOpenOptions{DetectDotGit: true})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		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
 | 
			
		||||
	repo, err := gogit.PlainOpenWithOptions(".", &git.PlainOpenOptions{DetectDotGit: true})
 | 
			
		||||
	repo, err := git.PlainOpenWithOptions(".", &git.PlainOpenOptions{DetectDotGit: true})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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()
 | 
			
		||||
	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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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{
 | 
			
		||||
		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
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, ref := range branches {
 | 
			
		||||
	for {
 | 
			
		||||
		ref, err := branches.Next()
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return nil, nil, err
 | 
			
		||||
		}
 | 
			
		||||
		if ref.Name().Short() == branch {
 | 
			
		||||
			//Получаем ссылку на нужную ветку
 | 
			
		||||
			headRef = plumbing.NewHashReference(ref.Name(), ref.Hash())
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user