Stop querying base branch commit hash from API

This code was put in place in preparation for a feature that never
shipped. Namely, we wanted to use the commit hash for the base branch so
we can get an accurate `git log` involving the changes in a pull
request. However, getting the commit hash from API is not the way to go
because the latest commit might not be available in the person's local
repository, and using a local tracking branch for base such as
`origin/master` works quite well in most cases without dereferencing it.
This commit is contained in:
Mislav Marohnić 2020-03-31 13:34:16 +02:00
parent 24a332bb1b
commit 219e3ecc5b
3 changed files with 7 additions and 17 deletions

View file

@ -54,8 +54,7 @@ func (f *FakeHTTP) StubRepoResponse(owner, repo string) {
"name": "%s",
"owner": {"login": "%s"},
"defaultBranchRef": {
"name": "master",
"target": {"oid": "deadbeef"}
"name": "master"
},
"viewerPermission": "WRITE"
} } }
@ -76,8 +75,7 @@ func (f *FakeHTTP) StubForkedRepoResponse(forkFullName, parentFullName string) {
"name": "%s",
"owner": {"login": "%s"},
"defaultBranchRef": {
"name": "master",
"target": {"oid": "deadbeef"}
"name": "master"
},
"viewerPermission": "ADMIN",
"parent": {
@ -85,8 +83,7 @@ func (f *FakeHTTP) StubForkedRepoResponse(forkFullName, parentFullName string) {
"name": "%s",
"owner": {"login": "%s"},
"defaultBranchRef": {
"name": "master",
"target": {"oid": "deadbeef"}
"name": "master"
},
"viewerPermission": "READ"
}

View file

@ -28,10 +28,7 @@ type Repository struct {
HasIssuesEnabled bool
ViewerPermission string
DefaultBranchRef struct {
Name string
Target struct {
OID string
}
Name string
}
Parent *Repository
@ -127,7 +124,6 @@ func RepoNetwork(client *Client, repos []ghrepo.Interface) (RepoNetworkResult, e
viewerPermission
defaultBranchRef {
name
target { oid }
}
isPrivate
}

View file

@ -215,8 +215,7 @@ func TestPRCreate_cross_repo_same_branch(t *testing.T) {
"name": "REPO",
"owner": {"login": "OWNER"},
"defaultBranchRef": {
"name": "default",
"target": {"oid": "deadbeef"}
"name": "default"
},
"viewerPermission": "READ"
},
@ -226,8 +225,7 @@ func TestPRCreate_cross_repo_same_branch(t *testing.T) {
"name": "REPO",
"owner": {"login": "OWNER"},
"defaultBranchRef": {
"name": "default",
"target": {"oid": "deadbeef"}
"name": "default"
},
"viewerPermission": "READ"
},
@ -235,8 +233,7 @@ func TestPRCreate_cross_repo_same_branch(t *testing.T) {
"name": "REPO",
"owner": {"login": "MYSELF"},
"defaultBranchRef": {
"name": "default",
"target": {"oid": "deadbeef"}
"name": "default"
},
"viewerPermission": "WRITE"
} } }