#8 add gitlab #13

Closed
kgorbunov wants to merge 93 commits from kgorbunov/pkgdash:master into master
2 changed files with 0 additions and 48 deletions
Showing only changes of commit 7645d9dcf7 - Show all commits

View File

@ -284,21 +284,6 @@ func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod
logger.Fatal(ctx, fmt.Sprintf("failed to open repo: %v", err))
}
if err = wtree.Checkout(&git.CheckoutOptions{
Hash: headRef.Hash(),
Branch: headRef.Name(),
Create: false,
Force: true,
}); err != nil {
logger.Error(ctx, fmt.Sprintf("failed to checkout tree: %v", err))
return err
}
err = repo.DeleteBranch(fmt.Sprintf("pkgdash/go_modules/%s-%s", path, mod.Version))
if err != nil {
logger.Error(ctx, fmt.Sprintf("Delete local branch error: %s", err))
}
return nil
}
@ -473,28 +458,3 @@ func GetPulls(ctx context.Context, url, owner, repo, token string) ([]*giteaPull
return pullsAll, nil
}
func deleteLocalBranch() {
ctx := context.Background()
repo, err := git.PlainOpenWithOptions(".", &git.PlainOpenOptions{DetectDotGit: true})
if err != nil {
logger.Fatal(ctx, fmt.Sprintf("failed to open repo: %v", err))
}
refIter, err := repo.Branches() //получение веток
if err != nil {
logger.Fatal(ctx, fmt.Sprintf("failed to get branches: %v", err))
}
for {
ref, err := refIter.Next()
if err != nil {
break
}
if strings.HasPrefix(ref.Name().Short(), "pkgdash/") {
err = repo.DeleteBranch(ref.Name().Short())
logger.Fatal(ctx, fmt.Sprintf("Delete error: %s", err))
}
}
refIter.Close()
}

View File

@ -1,8 +0,0 @@
package gitea
import "testing"
func Test_deleteLocalBranch(t *testing.T) {
_ = t
deleteLocalBranch()
}