Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept trailing slash in URIs for git fork #575

Closed

Conversation

lahodaj
Copy link

@lahodaj lahodaj commented Apr 9, 2020

Consider a command like this:
$ git fork https://github.com/openjdk/skara/

This fails with a fairly cryptic error:
Apr 09, 2020 11:39:44 AM org.openjdk.skara.network.RestRequest transformBadResponse
WARNING: org.openjdk.skara.network.RestRequest$QueryBuilder@2a17b7b6
Apr 09, 2020 11:39:44 AM org.openjdk.skara.network.RestRequest transformBadResponse
WARNING: {"message":"Not Found","documentation_url":"https://developer.github.com/v3"}
Exception in thread "main" java.lang.RuntimeException: Request returned bad status: 404
at org.openjdk.skara.network/org.openjdk.skara.network.RestRequest.transformBadResponse(RestRequest.java:285)
at org.openjdk.skara.network/org.openjdk.skara.network.RestRequest.execute(RestRequest.java:325)
at org.openjdk.skara.network/org.openjdk.skara.network.RestRequest$QueryBuilder.execute(RestRequest.java:156)
at org.openjdk.skara.forge/org.openjdk.skara.forge.github.GitHubRepository.fork(GitHubRepository.java:231)
at org.openjdk.skara.cli/org.openjdk.skara.cli.GitFork.main(GitFork.java:278)
at org.openjdk.skara.cli/org.openjdk.skara.cli.GitSkara.main(GitSkara.java:186)

The cause is the trailing '/', which is normally accepted when accessing the repository through a web browser, or when cloning the repository. This patch changes the git fork to also accept trailing slashes, by removing them before the GitHubRepository repository instance is created. It is not quite clear if this should be solved at some other level, but felt like a better approach to keep the APIs clean (i.e. just plain repository names), and do normalization in the UI tools.


Progress

  • Change must not contain extraneous whitespace
  • Change must be properly reviewed

Reviewers

  • Erik Helin (ehelin - Reviewer) ⚠️ Review applies to dcba058

Download

$ git fetch https://git.openjdk.java.net/skara pull/575/head:pull/575
$ git checkout pull/575

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Apr 9, 2020

👋 Welcome back jlahoda! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request.

@mlbridge
Copy link

@mlbridge mlbridge bot commented Apr 9, 2020

Webrevs

edvbld
edvbld approved these changes Apr 14, 2020
Copy link
Member

@edvbld edvbld left a comment

Looks good!

@openjdk
Copy link

@openjdk openjdk bot commented Apr 14, 2020

@lahodaj This change now passes all automated pre-integration checks. When the change also fulfills all project specific requirements, type /integrate in a new comment to proceed. After integration, the commit message will be:

Accept trailing slash in URIs for git fork

Reviewed-by: ehelin
  • If you would like to add a summary, use the /summary command.
  • To credit additional contributors, use the /contributor command.
  • To add additional solved issues, use the /solves command.

Since the source branch of this PR was last updated there have been 2 commits pushed to the master branch. Since there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid automatic rebasing, please merge master into your branch, and then specify the current head hash when integrating, like this: /integrate 444f61c3bb4ca00186ec4bdc7e92f9a08f78948d.

As you do not have Committer status in this project, an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@edvbld) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready label Apr 14, 2020
@edvbld
Copy link
Member

@edvbld edvbld commented Apr 14, 2020

Hi Jan,

thanks for contributing! Just a super minor nit before you integrate this pull request, could you remove the "." (period) in the title? In general we don't end pull request titles with a period, similar to how we in JBS don't end bug titles with a period.

Thanks!
Erik

@lahodaj lahodaj force-pushed the git-fork-accept-trailing-slash branch from dcba058 to 4a27976 Compare Apr 14, 2020
@lahodaj lahodaj changed the title Accept trailing slash in URIs for git fork. Accept trailing slash in URIs for git fork Apr 14, 2020
@lahodaj
Copy link
Author

@lahodaj lahodaj commented Apr 14, 2020

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Apr 14, 2020

@lahodaj
Your change (at version 4a27976) is now ready to be sponsored by a Committer.

@openjdk openjdk bot added the sponsor label Apr 14, 2020
@edvbld
Copy link
Member

@edvbld edvbld commented Apr 14, 2020

/sponsor

@openjdk
Copy link

@openjdk openjdk bot commented Apr 14, 2020

@edvbld @lahodaj The following commits have been pushed to master since your change was applied:

  • d6d9776: 357: Mismatch between PR body and RFR email

Your commit was automatically rebased without conflicts.

Pushed as commit 444f61c.

@mlbridge
Copy link

@mlbridge mlbridge bot commented Apr 14, 2020

Mailing list message from Erik Helin on skara-dev:

Changeset: 444f61c
Author: Jan Lahoda <jlahoda at openjdk.org>
Committer: Erik Helin <ehelin at openjdk.org>
Date: 2020-04-14 11:47:05 +0000
URL: https://git.openjdk.java.net/skara/commit/444f61c3

Accept trailing slash in URIs for git fork

Reviewed-by: ehelin

! cli/src/main/java/org/openjdk/skara/cli/GitFork.java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants