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 d33609e

Browse filesBrowse files
committed
Make sure getRepositories() for the user himself returns private repositories
This fixes issue hub4j#88
1 parent f2c08bc commit d33609e
Copy full SHA for d33609e

File tree

Expand file treeCollapse file tree

2 files changed

+17
-5
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+17
-5
lines changed

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHMyself.java
+10-1Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ public synchronized Map<String,GHRepository> getAllRepositories() throws IOExcep
102102
*
103103
* Unlike {@link #getAllRepositories()}, this does not wait until all the repositories are returned.
104104
*/
105-
public PagedIterable<GHRepository> listAllRepositories() {
105+
@Override
106+
public PagedIterable<GHRepository> listRepositories() {
106107
return new PagedIterable<GHRepository>() {
107108
public PagedIterator<GHRepository> iterator() {
108109
return new PagedIterator<GHRepository>(root.retrieve().asIterator("/user/repos", GHRepository[].class)) {
@@ -116,6 +117,14 @@ protected void wrapUp(GHRepository[] page) {
116117
};
117118
}
118119

120+
/**
121+
* @deprecated
122+
* Use {@link #listRepositories()}
123+
*/
124+
public PagedIterable<GHRepository> listAllRepositories() {
125+
return listRepositories();
126+
}
127+
119128
// public void addEmails(Collection<String> emails) throws IOException {
120129
//// new Requester(root,ApiVersion.V3).withCredential().to("/user/emails");
121130
// root.retrieveWithAuth3()

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHPerson.java
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,16 @@ protected void populate() throws IOException {
4343
}
4444

4545
/**
46-
* Gets the repositories this user owns.
46+
* Gets the public repositories this user owns.
47+
*
48+
* <p>
49+
* To list your own repositories, including private repositories,
50+
* use {@link GHMyself#listRepositories()}
4751
*/
4852
public synchronized Map<String,GHRepository> getRepositories() throws IOException {
4953
Map<String,GHRepository> repositories = new TreeMap<String, GHRepository>();
50-
for (List<GHRepository> batch : iterateRepositories(100)) {
51-
for (GHRepository r : batch)
52-
repositories.put(r.getName(),r);
54+
for (GHRepository r : listRepositories()) {
55+
repositories.put(r.getName(),r);
5356
}
5457
return Collections.unmodifiableMap(repositories);
5558
}

0 commit comments

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