Skip to content

Commit

Permalink
Set scm.PR.Sha to scm.PR.Head.Sha when loading from disk.
Browse files Browse the repository at this point in the history
This guarantee is made when retrieving a PR from a provider, but we do not persist
that guarantee when roundtripping from disk.
  • Loading branch information
dlorenc authored and tekton-robot committed Dec 6, 2019
1 parent 7ff3f78 commit 49ec715
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/pullrequest/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ func FromDisk(path string) (*Resource, error) {
return nil, err
}

r.PR.Sha = r.PR.Head.Sha

return r, nil
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/pullrequest/disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@ func TestFromDisk(t *testing.T) {
if diff := cmp.Diff(rsrc.PR.Head, head); diff != "" {
t.Errorf("Get Head: -want +got: %s", diff)
}
if diff := cmp.Diff(rsrc.PR.Sha, head.Sha); diff != "" {
t.Errorf("Get Sha: -want +got: %s", diff)
}

// Check the comments
commentMap := map[int]scm.Comment{}
Expand Down

0 comments on commit 49ec715

Please sign in to comment.