Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Clutch
Commits
88f2514a
Unverified
Commit
88f2514a
authored
4 years ago
by
Shawna Monero
Committed by
GitHub
4 years ago
Browse files
Options
Download
Email Patches
Plain Diff
add parent to parent (#1631)
parent
a9683f4f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
backend/service/github/github.go
+12
-5
backend/service/github/github.go
backend/service/github/github_test.go
+5
-0
backend/service/github/github_test.go
with
17 additions
and
5 deletions
+17
-5
backend/service/github/github.go
+
12
-
5
View file @
88f2514a
...
...
@@ -365,6 +365,7 @@ type Commit struct {
Files
[]
*
githubv3
.
CommitFile
Message
string
Author
*
githubv3
.
User
ParentRef
string
}
func
(
s
*
svc
)
GetCommit
(
ctx
context
.
Context
,
ref
*
RemoteRef
)
(
*
Commit
,
error
)
{
...
...
@@ -374,11 +375,17 @@ func (s *svc) GetCommit(ctx context.Context, ref *RemoteRef) (*Commit, error) {
}
// Currently we are using the Author (Github) rather than commit Author (Git)
ret
urn
&
Commit
{
ret
Commit
:=
&
Commit
{
Files
:
commit
.
Files
,
Message
:
commit
.
GetCommit
()
.
GetMessage
(),
Author
:
commit
.
GetAuthor
(),
},
nil
}
if
commit
.
Parents
!=
nil
&&
len
(
commit
.
Parents
)
>
0
{
retCommit
.
ParentRef
=
commit
.
Parents
[
0
]
.
GetSHA
()
}
return
retCommit
,
nil
}
func
(
s
*
svc
)
GetRepository
(
ctx
context
.
Context
,
repo
*
RemoteRef
)
(
*
Repository
,
error
)
{
...
...
This diff is collapsed.
Click to expand it.
backend/service/github/github_test.go
+
5
-
0
View file @
88f2514a
...
...
@@ -372,6 +372,7 @@ var getCommitsTests = []struct {
authorLogin
string
authorAvatarURL
string
authorID
int64
parentRef
string
}{
{
name
:
"v3 error"
,
...
...
@@ -385,6 +386,7 @@ var getCommitsTests = []struct {
message
:
"committing some changes (#1)"
,
authorAvatarURL
:
"https://foo.bar/baz.png"
,
authorID
:
1234
,
parentRef
:
"test"
,
},
}
...
...
@@ -422,6 +424,9 @@ func TestGetCommit(t *testing.T) {
a
.
Equal
(
tt
.
authorAvatarURL
,
*
commit
.
Author
.
AvatarURL
)
a
.
Equal
(
tt
.
authorID
,
*
commit
.
Author
.
ID
)
}
if
commit
.
ParentRef
!=
""
{
a
.
Equal
(
tt
.
parentRef
,
commit
.
ParentRef
)
}
a
.
Nil
(
err
)
})
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help