Skip to content

Commit

Permalink
fix(fork): Spotless-required changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
gounthar committed Dec 12, 2024
1 parent 43730bf commit 86ca3f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/main/java/org/kohsuke/github/GHRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ public GHRepository createFork(@Nullable String organization, @Nullable String n
name = name != null ? name : this.name;
GHRepository r;
try {
r = GHRepository.read(root(), root().getMyself().getLogin(), name);
r = GHRepository.read(root(), root().getMyself().getLogin(), name);
} catch (FileNotFoundException e) {
r = null;
}
Expand All @@ -1558,9 +1558,11 @@ public GHRepository createFork(@Nullable String organization, @Nullable String n
/**
* Creates a fork of this repository.
*
* @param defaultBranchOnly if true, only the default branch will be forked
* @param defaultBranchOnly
* if true, only the default branch will be forked
* @return the newly forked repository
* @throws IOException if an I/O error occurs
* @throws IOException
* if an I/O error occurs
*/
public GHRepository createFork(boolean defaultBranchOnly) throws IOException {
return createFork(null, null, defaultBranchOnly);
Expand All @@ -1570,7 +1572,8 @@ public GHRepository createFork(boolean defaultBranchOnly) throws IOException {
* Creates a fork of this repository with the default branch only.
*
* @return the newly forked repository
* @throws IOException if an I/O error occurs
* @throws IOException
* if an I/O error occurs
*/
public GHRepository createFork() throws IOException {
return createFork(true);
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/org/kohsuke/github/GHRepositoryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,8 @@ public void testCreateForkWithValidParameters() throws IOException {
String repositoryName = "rubywm";
String upstreamRepositoryOrganization = "kohsuke";
cleanupRepository(GITHUB_API_TEST_ORG + "/" + repositoryName);
GHRepository forkedRepository = gitHub.getRepository(upstreamRepositoryOrganization + "/" + repositoryName).createFork(gitHub.getOrganization(GITHUB_API_TEST_ORG).name, repositoryName, true);
GHRepository forkedRepository = gitHub.getRepository(upstreamRepositoryOrganization + "/" + repositoryName)
.createFork(gitHub.getOrganization(GITHUB_API_TEST_ORG).name, repositoryName, true);
assertThat(forkedRepository, notNullValue());
assertThat(forkedRepository.getOwnerName(), equalTo("new-owner"));
assertThat(forkedRepository.getName(), equalTo("new-repo"));
Expand Down

0 comments on commit 86ca3f0

Please sign in to comment.