Skip to content

Commit

Permalink
a small change
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisStatham committed Jul 12, 2024
1 parent 25af300 commit da6ac1d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions internal/git/gogit/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (g *Git) GetFileChangesAsBase64(w git.Worktree) error {
for path, status := range treeStatus {
s := status.Worktree

if s == git.Deleted {
if s == git.Deleted || s == git.Renamed || s == git.Copied {
g.deletions = append(g.deletions, path)
} else if s == git.Added || s == git.Modified || s == git.Untracked {
data, err := os.ReadFile(g.Directory + "/" + path)
Expand All @@ -105,8 +105,6 @@ func (g *Git) GetFileChangesAsBase64(w git.Worktree) error {
base64.StdEncoding.Encode(output, data)

g.additions[path] = string(output)
} else if s == git.Renamed || s == git.Copied {
// Skipping this case for now, but we should handle it
}
}

Expand Down
6 changes: 2 additions & 4 deletions internal/scm/github/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (g *Github) CommitThroughAPI(ctx context.Context, input CreateCommitOnBranc
}
`

var v varTemplate
var v createCommitOnBranchInput

v.Input.Branch.RepositoryNameWithOwner = input.RepositoryNameWithOwner
v.Input.Branch.BranchName = input.BranchName
Expand All @@ -137,9 +137,7 @@ func (g *Github) CommitThroughAPI(ctx context.Context, input CreateCommitOnBranc

err := g.makeGraphQLRequest(ctx, query, v, &result)

fmt.Printf("%s\n", v)
if err != nil {
fmt.Printf("ERROR\n")
return err
}

Expand Down Expand Up @@ -190,7 +188,7 @@ type graphqlPR struct {
} `json:"commits"`
}

type varTemplate struct {
type createCommitOnBranchInput struct {
Input struct {
ExpectedHeadOid string `json:"expectedHeadOid"`
Branch struct {
Expand Down

0 comments on commit da6ac1d

Please sign in to comment.