Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions applier.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"time"

"github.com/bluekeyes/go-gitdiff/gitdiff"
"github.com/google/go-github/v74/github"
"github.com/google/go-github/v75/github"
)

// DefaultCommitMessage is the commit message used when no message is provided
Expand Down Expand Up @@ -71,7 +71,7 @@ func (a *Applier) Apply(ctx context.Context, f *gitdiff.File) (*github.TreeEntry
}

if entry.Content != nil {
blob, _, err := a.client.Git.CreateBlob(ctx, a.owner, a.repo, &github.Blob{
blob, _, err := a.client.Git.CreateBlob(ctx, a.owner, a.repo, github.Blob{
Content: entry.Content,
Encoding: github.String("base64"),
})
Expand Down Expand Up @@ -262,7 +262,7 @@ func (a *Applier) Commit(ctx context.Context, tmpl *github.Commit, header *gitdi
c.Message = github.String("Apply patch with patch2pr")
}

commit, _, err := a.client.Git.CreateCommit(ctx, a.owner, a.repo, &c, nil)
commit, _, err := a.client.Git.CreateCommit(ctx, a.owner, a.repo, c, nil)
if err != nil {
return nil, err
}
Expand Down
17 changes: 8 additions & 9 deletions applier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

"github.com/bluekeyes/go-gitdiff/gitdiff"
"github.com/bluekeyes/patch2pr/internal"
"github.com/google/go-github/v74/github"
"github.com/google/go-github/v75/github"
"github.com/shurcooL/githubv4"
)

Expand Down Expand Up @@ -279,7 +279,7 @@ func createBranch(t *testing.T, tctx *TestContext) {

if strings.HasSuffix(d.Name(), ".bin") {
c := base64.StdEncoding.EncodeToString(content)
blob, _, err := tctx.Client.Git.CreateBlob(tctx, tctx.Repo.Owner, tctx.Repo.Name, &github.Blob{
blob, _, err := tctx.Client.Git.CreateBlob(tctx, tctx.Repo.Owner, tctx.Repo.Name, github.Blob{
Encoding: github.String("base64"),
Content: &c,
})
Expand Down Expand Up @@ -308,23 +308,22 @@ func createBranch(t *testing.T, tctx *TestContext) {
t.Fatalf("error getting recursive tree: %v", err)
}

commit := &github.Commit{
commitToCreate := github.Commit{
Message: github.String("Base commit for test"),
Tree: tree,
}
commit, _, err = tctx.Client.Git.CreateCommit(tctx, tctx.Repo.Owner, tctx.Repo.Name, commit, nil)

commit, _, err := tctx.Client.Git.CreateCommit(tctx, tctx.Repo.Owner, tctx.Repo.Name, commitToCreate, nil)
if err != nil {
t.Fatalf("error creating commit: %v", err)
}

tctx.BaseCommit = commit
tctx.BaseTree = fullTree

if _, _, err := tctx.Client.Git.CreateRef(tctx, tctx.Repo.Owner, tctx.Repo.Name, &github.Reference{
Ref: github.String(tctx.Branch(BaseBranch)),
Object: &github.GitObject{
SHA: commit.SHA,
},
if _, _, err := tctx.Client.Git.CreateRef(tctx, tctx.Repo.Owner, tctx.Repo.Name, github.CreateRef{
Ref: tctx.Branch(BaseBranch),
SHA: commit.GetSHA(),
}); err != nil {
t.Fatalf("error creating ref: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/patch2pr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"time"

"github.com/bluekeyes/go-gitdiff/gitdiff"
"github.com/google/go-github/v74/github"
"github.com/google/go-github/v75/github"

"github.com/bluekeyes/patch2pr"
"github.com/bluekeyes/patch2pr/internal"
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module github.com/bluekeyes/patch2pr

go 1.23.0
go 1.24.0

require (
github.com/bluekeyes/go-gitdiff v0.8.1
github.com/google/go-github/v74 v74.0.0
github.com/google/go-github/v75 v75.0.0
github.com/shurcooL/githubv4 v0.0.0-20210922025249-6831e00d857f
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ github.com/bluekeyes/go-gitdiff v0.8.1/go.mod h1:WWAk1Mc6EgWarCrPFO+xeYlujPu98Vu
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/go-github/v74 v74.0.0 h1:yZcddTUn8DPbj11GxnMrNiAnXH14gNs559AsUpNpPgM=
github.com/google/go-github/v74 v74.0.0/go.mod h1:ubn/YdyftV80VPSI26nSJvaEsTOnsjrxG3o9kJhcyak=
github.com/google/go-github/v75 v75.0.0 h1:k7q8Bvg+W5KxRl9Tjq16a9XEgVY1pwuiG5sIL7435Ic=
github.com/google/go-github/v75 v75.0.0/go.mod h1:H3LUJEA1TCrzuUqtdAQniBNwuKiQIqdGKgBo1/M/uqI=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/shurcooL/githubv4 v0.0.0-20210922025249-6831e00d857f h1:q4b8/GCL8Ksl+okhFKSd8DVBQNc0XExjxTO68nK0c3Y=
Expand Down
2 changes: 1 addition & 1 deletion graphql_applier.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"path"

"github.com/bluekeyes/go-gitdiff/gitdiff"
"github.com/google/go-github/v74/github"
"github.com/google/go-github/v75/github"
"github.com/shurcooL/githubv4"
)

Expand Down
20 changes: 8 additions & 12 deletions reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"strings"

"github.com/google/go-github/v74/github"
"github.com/google/go-github/v75/github"
)

// Reference is a named reference in a repository.
Expand Down Expand Up @@ -48,20 +48,16 @@ func (r *Reference) Set(ctx context.Context, sha string, force bool) error {
}

if exists {
if _, _, err := r.client.Git.UpdateRef(ctx, r.owner, r.repo, &github.Reference{
Ref: github.String(r.ref),
Object: &github.GitObject{
SHA: github.String(sha),
},
}, force); err != nil {
if _, _, err := r.client.Git.UpdateRef(ctx, r.owner, r.repo, r.ref, github.UpdateRef{
SHA: sha,
Force: github.Ptr(force),
}); err != nil {
return fmt.Errorf("update ref failed: %w", err)
}
} else {
if _, _, err := r.client.Git.CreateRef(ctx, r.owner, r.repo, &github.Reference{
Ref: github.String(r.ref),
Object: &github.GitObject{
SHA: github.String(sha),
},
if _, _, err := r.client.Git.CreateRef(ctx, r.owner, r.repo, github.CreateRef{
Ref: r.ref,
SHA: sha,
}); err != nil {
return fmt.Errorf("create ref failed: %w", err)
}
Expand Down
Loading