Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 976960f

Browse filesBrowse files
committed
Merge pull request hub4j#42 from paulbutenko/master
Commit's short info model
2 parents d2f2f3b + c4e0729 commit 976960f
Copy full SHA for 976960f

File tree

Expand file treeCollapse file tree

2 files changed

+90
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+90
-1
lines changed

‎src/main/java/org/kohsuke/github/GHCommit.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHCommit.java
+84-1Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,79 @@
1616
*/
1717
public class GHCommit {
1818
private GHRepository owner;
19+
20+
private GHCommitShortInfo commit;
21+
22+
public static class GHCommitShortInfo {
23+
private GHAuthor author;
24+
25+
private GHAuthor committer;
26+
27+
private String message;
28+
29+
private int comment_count;
30+
31+
public GHAuthor getAuthor() {
32+
return author;
33+
}
34+
35+
public void setAuthor(GHAuthor author) {
36+
this.author = author;
37+
}
38+
39+
public GHAuthor getCommitter() {
40+
return committer;
41+
}
42+
43+
public void setCommitter(GHAuthor committer) {
44+
this.committer = committer;
45+
}
46+
47+
public String getMessage() {
48+
return message;
49+
}
50+
51+
public void setMessage(String message) {
52+
this.message = message;
53+
}
54+
55+
public int getComment_count() {
56+
return comment_count;
57+
}
58+
59+
public void setComment_count(int comment_count) {
60+
this.comment_count = comment_count;
61+
}
62+
}
63+
64+
public static class GHAuthor {
65+
private String name,email,date;
66+
67+
public String getName() {
68+
return name;
69+
}
70+
71+
public void setName(String name) {
72+
this.name = name;
73+
}
74+
75+
public String getEmail() {
76+
return email;
77+
}
78+
79+
public void setEmail(String email) {
80+
this.email = email;
81+
}
82+
83+
public String getDate() {
84+
return date;
85+
}
86+
87+
public void setDate(String date) {
88+
this.date = date;
89+
}
90+
91+
}
1992

2093
public static class Stats {
2194
int total,additions,deletions;
@@ -110,8 +183,18 @@ static class User {
110183
Stats stats;
111184
List<Parent> parents;
112185
User author,committer;
186+
187+
113188

114-
/**
189+
public GHCommitShortInfo getCommitShortInfo() {
190+
return commit;
191+
}
192+
193+
public void setCommit(GHCommitShortInfo commit) {
194+
this.commit = commit;
195+
}
196+
197+
/**
115198
* The repository that contains the commit.
116199
*/
117200
public GHRepository getOwner() {

‎src/test/java/org/kohsuke/AppTest.java

Copy file name to clipboardExpand all lines: src/test/java/org/kohsuke/AppTest.java
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,12 @@ public void testCommitStatus() throws Exception {
332332
assertEquals("oops!",state.getDescription());
333333
assertEquals("http://jenkins-ci.org/",state.getTargetUrl());
334334
}
335+
336+
public void testCommitShortInfo() throws Exception {
337+
GHCommit commit = gitHub.getUser("kohsuke").getRepository("test").getCommit("c77360d6f2ff2c2e6dd11828ad5dccf72419fa1b");
338+
assertEquals(commit.getCommitShortInfo().getAuthor().getName(), "Kohsuke Kawaguchi");
339+
assertEquals(commit.getCommitShortInfo().getMessage(), "Added a file");
340+
}
335341

336342
public void testPullRequestPopulate() throws Exception {
337343
GHRepository r = gitHub.getUser("kohsuke").getRepository("github-api");

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.